123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- //
- // UIFormatter.h
- // test11
- //
- // Created by apple on 15/11/13.
- // Copyright (c) 2016年 JCZ. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- #import <UIKit/UIKit.h>
- #import "UIImage+resize.h"
- #import "UIView+Frame.h"
- #pragma mark - UI宏
- #define kStatusHeight (kSize.height == 812.0 ? 44 : 20)
- #define kNavOffSet (kSize.height == 812.0 ? 88 : 64)
- #define kTabBarHeight (kSize.height == 812.0 ? 83 : 49)
- #define SafeAreaBottomHeight (kSize.height == 812.0 ? 34 : 0)
- #define kSegmentHeight 44
- #define kSize [[UIScreen mainScreen]bounds].size
- #ifndef kFrame
- #define kFrame [[UIScreen mainScreen]bounds]
- #endif
- //colors
- #define newBackGroundColor [UIColor colorWithRed:75/255.0 green:85/255.0 blue:132/255.0 alpha:1]
- #define newTitleColor [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1]
- #define newSubTitleColor [UIColor colorWithRed:200/255.0 green:200/255.0 blue:200/255.0 alpha:1]
- #define newContentTextColor [UIColor colorWithRed:150/255.0 green:150/255.0 blue:150/255.0 alpha:1]
- #define canClickColor [UIColor colorWithRed:134/255.0 green:204/255.0 blue:71/255.0 alpha:1]
- #define defGreen [UIColor colorWithRed:253/255.0 green:137/255.0 blue:38/255.0 alpha:1]
- #define backGroundColor [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1]
- #define stateBarColor [UIColor colorWithRed:22/255.0 green:90/255.0 blue:140/255.0 alpha:1]
- #define windowBlockColor [UIColor colorWithWhite:.2 alpha:.2]
- #define lineColor [UIColor colorWithWhite:.3 alpha:.1]
- #define titleColor [UIColor colorWithRed:70/255.0 green:70/255.0 blue:70/255.0 alpha:1]
- #define subTitleColor [UIColor colorWithWhite:.3 alpha:1]
- #define contentTextColor [UIColor colorWithRed:110/255.0 green:110/255.0 blue:110/255.0 alpha:1]
- #define RGBA_COLOR(R, G, B, A) [UIColor colorWithRed:((R) / 255.0f) green:((G) / 255.0f) blue:((B) / 255.0f) alpha:A]
- #define RGB_COLOR(R, G, B) [UIColor colorWithRed:((R) / 255.0f) green:((G) / 255.0f) blue:((B) / 255.0f) alpha:1.0f]
- //简单setFrame
- #define setxywh initWithFrame:CGRectMake(x, y, w, h)
- #define setDIYFrame CGRectMake(x, y, w, h)
- //字体
- #define largeFont [UIFont scaleSize:20 weight:10]
- #define midFont [UIFont scaleSize:14 weight:5]
- #define smallFont [UIFont scaleSize:10 weight:4]
- #define Font21 21
- #define Font18 18
- #define Font17 17
- #define Font16 16
- #define Font14 14
- #define Font10 10
- #define unOpenMsg @"暂未开放,敬请期待"
- /**自动屏幕适配,把屏幕当成320*480来写就行 该方法不适用于动画
- */
- CGRect SGRectMake(CGFloat x, CGFloat y,CGFloat width,CGFloat height);
- /**自动屏幕适配基础上,固定frame的height不进行适配
- */
- CGRect SGRectMakeCH(CGFloat x, CGFloat y,CGFloat width,CGFloat height);
- /**自动屏幕适配基础上,固定frame的y不进行适配
- */
- CGRect SGRectMakeCY(CGFloat x, CGFloat y,CGFloat width,CGFloat height);
- /**自动屏幕适配基础上,固定frame的y,heigh不进行适配
- */
- CGRect SGRectMakeCYH(CGFloat x, CGFloat y,CGFloat width,CGFloat height);
- CGSize SGSizeMake(CGFloat width,CGFloat height);
- /**自动屏幕适配的竖向float
- */
- CGFloat SGFloat(CGFloat k);
- @interface UIFormatter : NSObject
- @end
- //@interface UIViewController(Navigation)
- ///**通用导航栏,设置好leftBBI,及其事件
- // */
- //
- ///**通过导航栏返回上级菜单
- // */
- //-(void)configNavigationBar;
- //
- ////回到导航控制器的首页
- //-(void)configNavigationBarFirstVC;
- //
- //
- ///**隐藏导航栏
- // */
- //-(void)navPushHideTabbarToVC:(UIViewController*)vc;
- ///**这个是隐藏返回按钮的.主要是给搜教练VC用的。因为,它要禁止返回。
- // */
- //-(void)configNavigationBarHideLeft;
- ///**返回直接跳转到rootVC
- // */
- //-(void)configNavigationBarPopRoot;
- //
- //@end
- @interface UIView(formatter)
- -(void)setRound;
- -(void)setBoardWid:(CGFloat)width Color:(UIColor*)color;
- /**注意:这个headerView是添加到self的superview里面去的。
- */
- -(void)addViewWithRect:(CGRect)re Color:(UIColor*)color;
- -(void)addViewWithRect:(CGRect)re;
- /**这个是加到self。
- */
- -(void)addSelfViewWithRect:(CGRect)re Color:(UIColor*)color;
- -(void)scale:(CGFloat)rate;
- @end
- @interface UIImage (Extension)
- /**生成的图片的rect默认为100,100
- */
- + (UIImage *)imageWithColor:(UIColor *)color;
- @end
- @interface UIImage(tint)
- -(UIImage*)tint:(UIColor*)color;
- @end
- @interface UIImage (scale)
- -(UIImage*)originImageScaleToSize:(CGSize)size;
- @end
- @interface UIFont(scale)
- /**以6plus为基准。屏幕越小,字体越小
- */
- +(id)scaleSize:(CGFloat)font;
- @end
- @interface UILabel(formatter)
- -(void)setFont:(CGFloat)font TextColor:(UIColor*)color;
- -(void)setText:(NSString*)text Font:(CGFloat)font TextColor:(UIColor*)color;
- -(void)setText:(NSString*)text Font:(CGFloat)font TextColor:(UIColor*)color Alignment:(NSTextAlignment)align;
- @end
- UIImage* randomPortrait(void);
- UIColor * randomColor(void);
- void setRandomColor(UIView* vi);
|