美文网首页
一些小技巧随时更新

一些小技巧随时更新

作者: 小龙88 | 来源:发表于2017-06-02 14:25 被阅读0次

    mac终端MD5加密命令:echo -n "加密字符串" |md5

    mac终端从git克隆文件命令:git clone https://github.com/ibireme/YYModel

    断点打印 po 字段名

    去除数组中重复元素

    NSArray *newArr = [oldArr valueForKeyPath:@“@distinctUnionOfObjects.self"];

    SDWebImage本地缓存有时候会害人。如果之前缓存过一张图片,即使下次服务器换了这张图片,但是图片url没换,用sdwebimage下载下来的还是以前那张,所以遇到这种问题,不要先去怼服务器,清空下缓存再试就好了。

    21、颜色转图片

    + (UIImage *)cl_imageWithColor:(UIColor *)color {

    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);

    UIGraphicsBeginImageContext(rect.size);

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, [color CGColor]);

    CGContextFillRect(context, rect);

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    returnimage;

    }

    修改textField的placeholder的字体颜色、大小

    [textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];

    [textField setValue [UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];

    用#define kDISPATCH_GLOBAL_QUEUE_DEFAULT(globalQueueBlock) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), globalQueueBlocl);

    22、解除循环引用的方法

    1.__weak

    2.利用RAC提供的weak-strong dance  在block外部用@weakify(self) 在block内部用@strongify(self)

    相关文章

      网友评论

          本文标题:一些小技巧随时更新

          本文链接:https://www.haomeiwen.com/subject/eakufxtx.html