87 lines
2.9 KiB
Objective-C
Executable File

//
// sysInfo.h
// myhome
//
// Created by hkh on 15/10/31.
//
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#ifndef Talk_UI_h
#define Talk_UI_h
#define kIs_iphone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define kIs_iPhoneX ScreenWidth >=375.0f && ScreenHeight >=812.0f&& kIs_iphone
#define ScreenWidth ([UIScreen mainScreen].bounds.size.width)
#define ScreenHeight ([UIScreen mainScreen].bounds.size.height)
//#define KstatusHeight (20.0)
//#define KnavigationHeight (44.0)
//#define KstatusAndNavHeight (64.0)
#define TabBarHeight (49.0)
#define KScreenWidth (ScreenWidth)
//#define KScreenHeight (ScreenHeight - KstatusHeight- KnavigationHeight)
#define kBottomSafeHeight (CGFloat)(kIs_iPhoneX?(34.0):(0))
#define KScreenOriginX 0
#define KScreenOriginY (KstatusHeight)
#endif
typedef NS_ENUM(NSInteger, UIPosition) {
UIAabsolute = 0,
UIRelative = 1,
};
typedef NS_ENUM(NSInteger, UIPositionInParent) {
UITopLeft = 0,
UITopMid = 1,
UITopRight = 2,
UIMidLeft = 3,
UICenter = 4,
UIMidRight = 5,
UIBottomLeft = 6,
UIBottomMid = 7,
UIBottomRight = 8,
};
typedef NS_ENUM(NSInteger, UIPositionByView) {
TopAlignLeft = 0,
TopAlignCenter = 1,
TopAlignRight = 2,
RightAlignTop = 3,
RightAlignCenter = 4,
RightAlignBottom = 5,
BottomAlignLeft = 6,
BottomAlignCenter = 7,
BottomAlignRight = 8,
LeftAlignTop = 9,
LeftAlignCenter = 10,
LeftAlignBottom = 11,
};
@interface UI : NSObject
+ (CGFloat)getScreenWidth;
+ (CGFloat)getScreenHeight;
+ (void)SetRView:(UIView *) view Top:(NSString *) t Right:(NSString *) r Bottom:(NSString *) b Left:(NSString *) l;
+ (void)setFrame:(UIView *) view Width:(NSString *) w Height:(NSString *) h Left:(NSString *) x Top:(NSString *) y;
+ (void)setFrameInView:(UIView *) view Width:(NSString *) w Height:(NSString *) h TranslateX:(NSString *) x TranslateY:(NSString *) y InView:(UIView *) parent Position:(UIPositionInParent)pos;
+ (void)setFrameByView:(UIView *) view Width:(NSString *) w Height:(NSString *) h TranslateX:(NSString *) x TranslateY:(NSString *) y ByView:(UIView *) brother Position:(UIPositionByView)pos;
+ (void)chgMargin:(UIView *) view Css:(NSString *) css;
+ (void)setCornerRadius:(UIView *) view;
+ (void)setGradientBorder:(UIView *)view withColor:(NSInteger)color;
+ (UIImage *)reSizeImage:(UIImage *)image toSize:(CGSize)reSize;
+ (UILabel *)NewLabel:(NSString *) text Color:(UIColor *)color Size:(CGFloat)size Align:(NSTextAlignment) align;
+ (UIColor *)colorWithHex:(NSInteger)hexValue;
+ (UIColor *)colorWithHex:(NSInteger)hexValue alpha:(CGFloat)alphaValue;
+ (CGFloat)getNavHeight;
+ (CGFloat)getStatuHeight;
+ (CGFloat)getStatuAndStatuHeight;
+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size;
@end