Giter VIP home page Giter VIP logo

mzextension's Introduction

MZExtension

A extension for OC

自定义控件(Extends)

1、MZBannerView(广告轮播)

2、MZCircleProgress(圆形倒计时)

3、MZMarqueeLabel(滚动字符串)

4、MZMobileField(手机号码344格式)

5、MZTableView(横向tableView)

6、MZTextField(textField字符串长度限制)

7、MZTextView(textView字符串长度限制和placeholder设置)

8、MZWaveView(双波浪试图)

9、MZImageBrowsing(图片浏览器)

10、MZAlertController(半透明控制器,类似UIAlertController功能)

11、MZDrawBoardView(CAShapeLayer实现画板功能,可在画板上写字绘画)

12、MZLongTapButton(长按按钮)

自定义类别

1、NSDictionary+MZTool

  1. 从字典中取出一个字典
  • -(NSDictionary *)dictionaryForKey:(NSString *)key;
  1. 从字典中取出一个数组
  • -(NSArray *)arrayForKey:(NSString *)key;
  1. 从字典中取出一个字符串
  • -(NSString *)stringForKey:(NSString *)key;
  1. 从字典中取出一个布尔值
  • -(BOOL)boolForKey:(NSString *)key;
  1. 从字典中取出一个整型数字
  • -(NSInteger)intForKey:(NSString *)key;
  1. 从字典中取出一个双精度型数字
  • -(double)doubleForKey:(NSString *)key;

2、UIImage+MZTool

  1. 根据颜色生成图片
  • +(UIImage *)getImageWithColor:(UIColor *)color;
  1. 根据字符串和二维码图片大小来生成二维码图片
  • +(UIImage *)createBarCodeImageWithString:(NSString *)string size:(CGFloat)size;
  1. 根据颜色的渐变色获取图片
  • +(UIImage *)createImageWithFrame:(CGRect)frame startColor:(UIColor *)startColor endColor:(UIColor *)endColor startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
  1. base64字符串转图片
  • +(UIImage *)stringToImage:(NSString *)base64String;
  1. 图片转base64字符串
  • -(NSString *)imageToBase64String;
  1. 截取view成图片
  • +(UIImage *)clipsImage:(UIView *)view;
  1. 对图片进行剪切,获取指定范围的图片
  • +(UIImage *)clipsImage:(UIImage *)image frame:(CGRect)frame;
  1. 新生成指定大小图片
  • +(UIImage *)resizeImage:(UIImage *)image toSize:(CGSize)size;
  1. 生成圆形图片
  • +(UIImage *)cutCircleImage:(UIImage *)image;
  1. 生成部分圆角图片
  • +(UIImage *)cutPartCircleImage:(UIImage *)image corners:(UIRectCorner)corners radii:(CGSize)radii;
  1. 处理图片旋转问题
  • +(UIImage *)fixOrientation:(UIImage *)aImage;

3、UIView+MZTool

  1. 设置试图背景颜色的渐变色
  • -(void)setupGradientColorWithStartColor:(UIColor *)startColor endColor:(UIColor *)endColor startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
  1. 给view添加点击事件
  • -(void)addTapGestureRecognizerWithTarget:(id)target selector:(SEL)selector;
  1. 根据一个VC上的view得到该VC
  • -(UIViewController *)getVC;
  1. 设置试图圆角
  • -(void)setRadius:(CGFloat)radius;
  1. 设置部分圆角
  • -(void)setRoundedCorners:(UIRectCorner)corners radii:(CGSize)radii;

4、NSObject+MZTool

  1. 获取当前显示的ViewController
  • +(UIViewController *)currentViewController;
  1. 获取屏幕窗口
  • +(UIView *)getWindowView;
  1. 获取手机当前连接的SSID(iOS12后要开启capabilities中的Access WiFi Information)
  • +(NSString *)SSID;
  1. 获取app版本号
  • +(NSString *)getAppVersion;
  1. 获取app Build
  • +(NSString *)getAppBuild;
  1. 获取app名称
  • +(NSString *)getAppName;
  1. 获取app BundleID
  • +(NSString *)getAppBundleIdentifier;
  1. 获取app Icon
  • +(UIImage *)getAppIcon;

5、NSString+MZTool

  1. 字符串MD5加密
  • -(NSString *)MD5;
  1. 普通字符串转换成十六进制字符串
  • +(NSString *)hexStringFromString:(NSString *)string;
  1. 十六进制字符串转换成普通字符串
  • +(NSString *)stringFromHexString:(NSString *)hexString;
  1. data转16进制字符串
  • +(NSString *)dataToHexString:(NSData *)data;
  1. 转为本地大端模式 返回Unsigned类型的数据
  • +(unsigned short)unsignedDataTointWithData:(NSData *)data Location:(NSInteger)location Offset:(NSInteger)offset;

6、UIViewController+MZAlert

  1. 系统提示框(确认按钮在左,取消按钮在右)
  • -(void)showAlertWithTitle:(NSString *)title message:(NSString *)message confirmTitle:(NSString *)confirmTitle cancelTitle:(NSString *)cancelTitle confirm:(void(^)(void))confirm cancel:(void(^)(void))cancel;
  1. 系统提示款(确认按钮在右,取消按钮在左)
  • -(void)showAlertWithTitle:(NSString *)title message:(NSString *)message cancelTitle:(NSString *)cancelTitle confirmTitle:(NSString *)confirmTitle confirm:(void(^)(void))confirm cancel:(void(^)(void))cancel;
  1. 系统提示款(只有一个按钮)
  • -(void)showAlertWithTitle:(NSString *)title message:(NSString *)message confirmTitle:(NSString *)confirmTitle confirm:(void (^)(void))confirm;
  1. 系统提示框(自定义标题和内容)
  • -(void)showAlertWithAttributedTitle:(NSAttributedString *)attributedTitle attributedMessage:(NSAttributedString *)attributedMessage confirmTitle:(NSString *)confirmTitle confirmStyle:(UIAlertActionStyle)confirmStyle cancelTitle:(NSString *)cancelTitle cancelStyle:(UIAlertActionStyle)cancelStyle confirm:(void(^)(void))confirm cancel:(void(^)(void))cancel;
  1. 系统提示框(自定义标题和内容以及按钮标题颜色)
  • -(void)showAlertWithAttributedTitle:(NSAttributedString *)attributedTitle attributedMessage:(NSAttributedString *)attributedMessage confirmTitle:(NSString *)confirmTitle confirmColor:(UIColor *)confirmColor cancelTitle:(NSString *)cancelTitle cancelColor:(UIColor *)cancelColor confirm:(void(^)(void))confirm cancel:(void(^)(void))cancel;
  1. 系统操作框
  • -(void)showActionSheetWithTitle:(NSString *)title message:(NSString *)message actionTitles:(NSArray<NSString *> *)actionTitles cancelTitle:(NSString *)cancelTitle cancelColor:(UIColor *)cancelColor callback:(void(^)(NSString *actionTitle))callback;
  1. 系统操作框(自定义标题和内容以及按钮标题颜色)
  • -(void)showActionSheetWithAttributedTitle:(NSAttributedString *)attributedTitle attributedMessage:(NSAttributedString *)attributedMessage actionTitles:(NSArray<NSString *> *)actionTitles actionColors:(NSArray<UIColor *> *)actionColors cancelTitle:(NSString *)cancelTitle cancelColor:(UIColor *)cancelColor callback:(void(^)(NSString *actionTitle))callback;

7、NSObject+MZDate

  1. 时间转字符串
  • +(NSString *)dateToStringWithDate:(NSDate *)date dateFormat:(NSString *)dateFormat;
  1. 字符串转时间
  • +(NSDate *)stringToDateWithString:(NSString *)string dateFormat:(NSString *)dateFormat;
  1. 间戳转字符串
  • +(NSString *)timeIntervalToStringWithTimeInterval:(NSTimeInterval)timeInterval dateFormat:(NSString *)dateFormat;
  1. 字符串转时间戳
  • +(NSTimeInterval)stringToTimeIntervalWithString:(NSString *)string dateFormat:(NSString *)dateFormat;
  1. 时间戳转特殊字符串(如果是今明两天,会将月日转换成“今天”或“明天”)
  • +(NSString *)specialTimeIntervalToStringWithTimeInterval:(NSTimeInterval)timeInterval dateFormat:(NSString *)dateFormat;
  1. 获取当前时间戳
  • +(NSTimeInterval)getNowTimeInterval;

8、UIButton+MZTouch

  1. 通过eventTimeInterval来设置UIButton点击间隔

9、NSArray+MZTool

  1. 获取数组中的最大值数组
  • -(void)caculateMaxArray:(void(^)(NSArray *maxArray,NSInteger startIndex,NSInteger endIndex))callback;

10、UIColor+MZTool

  1. 获取图片上某个点的颜色
  • +(UIColor *)colorAtPixel:(CGPoint)point withImage:(UIImage *)image;
  1. 根据16进制字符串获取颜色
  • +(UIColor *)colorWithHexString:(NSString *)hexString;

11、UIView+MZFrame

  • @property (nonatomic, assign) CGFloat mz_x;
  • @property (nonatomic, assign) CGFloat mz_y;
  • @property (nonatomic, assign) CGFloat mz_width;
  • @property (nonatomic, assign) CGFloat mz_height;
  • @property (nonatomic, assign) CGFloat mz_centerX;
  • @property (nonatomic, assign) CGFloat mz_centerY;

12、NSObject+MZAvoidCrash

  1. 统一处理找不到对应方法崩溃的问题
  2. 统一处理键值对编码找不到对应属性崩溃的问题

13、NSArray+MZLog

  1. 统一处理数组打印的问题

14、NSDictionary+MZLog

  1. 统一处理字典打印的问题

15、NSArray+MZTool

  1. 获取数组中的最大值数组
    • (void)caculateMaxArray:(void(^)(NSArray *maxArray,NSInteger startIndex,NSInteger endIndex))callback;

mzextension's People

Contributors

1691665955 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.