博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS常用代码块
阅读量:4046 次
发布时间:2019-05-24

本文共 1187 字,大约阅读时间需要 3 分钟。

这里向各位推荐一些简单常用的代码块

1.添加警告信息

#warning <#message#>

2.忽略 performSeletor 方法内存泄漏提醒

#pragma clang diagnostic ignored "-Warc-performSelector-leaks"

3.Masonry 省略前缀mas_ 的宏命令

/** 第三方框架 : Masonry *///define this constant if you want to use Masonry without the 'mas_' prefix#define MAS_SHORTHAND//define this constant if you want to enable auto-boxing for default syntax#define MAS_SHORTHAND_GLOBALS// 导入头文件#import "Masonry.h"

4.打标记

#pragma mark <#message#>
  1. 获取主队列
dispatch_async(dispatch_get_main_queue(), ^{        <#code#>    });

6.获取全局并发队列

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{        <#code#>    });
  1. 代理属性
@property (nonatomic,weak) id<<#protocol#>> <#delegate#>;

8.block 属性

@property (nonatomic,copy) <#Block#> <#block#>;
  1. afterGCD
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(<#delayInSeconds#> * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{        <#code to be executed after a specified delay#>    });
  1. weak 属性
@property (nonatomic, weak) <#type#> *<#name#>;

11.strong属性

@property (nonatomic,strong) <#type#> *<#name#>;

12.assign 属性

@property (nonatomic,assign) <#type#> <#name#>;

13.copy 属性

@property (nonatomic,copy) <#type#> *<#name#>;

转载地址:http://vfwci.baihongyu.com/

你可能感兴趣的文章
阿里、网易、滴滴共十次前端面试碰到的问题
查看>>
memcache、redis原理对比
查看>>
Node.js机制及原理理解初步
查看>>
linux CPU个数查看
查看>>
linux系统负载load average的含义
查看>>
分布式应用开发相关的面试题收集
查看>>
简单理解Socket及TCP/IP、Http、Socket的区别
查看>>
利用HTTP Cache来优化网站
查看>>
利用负载均衡优化和加速HTTP应用
查看>>
消息队列设计精要
查看>>
高可用性系统在大众点评的实践与经验
查看>>
美团酒店Node全栈开发实践
查看>>
分布式缓存负载均衡负载均衡的缓存处理:虚拟节点对一致性hash的改进
查看>>
分布式存储系统设计(1)—— 系统架构
查看>>
分布式存储系统设计(2)—— 数据分片
查看>>
架构师之路--视频业务介绍,离线服务架构和各种集群原理
查看>>
mysql、zookeeper、redis和elasticsearch主从同步机制
查看>>
MySQL数据库的高可用方案总结
查看>>
git 配置多个SSH-Key
查看>>
nodejs真的是单线程吗?
查看>>