ios9 新特性
2016-05-04 16:23
465 查看
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_END
在这两个之间必须属性赋值不可以为空
null_resettable 允许set为空 get不为空 需要重写set 方法
@property(null_resettable,strong,nonatomic)NSMutableArray * allDetailData;
@property(null_resettable,strong,nonatomic)NSMutableArray * allDetailData;
nonnull 属性赋值不可以为空 相反nullable可以
@property(nonnull,strong,nonatomic)NSMutableArray * allDetailData;
泛型
可以是设置一些集合中的数据赋值添加对象的属性
@property(strong,nonatomic)NSArray<NSString*>*explainArray;//警告只能为字符串这个的好处就是在得到数据的可以直接得到数组
@property(nonatomic,strong)NSDictionary<NSString*,NSNumber*> *dic ;key 是字符串 value 是number
自定义泛型
#import <Foundation/Foundation.h>
@interface car<ObjectType>: NSObject
-(void)add:(ObjectType)name;
@end
__covariant 小类型转大类型
__contravariant 大变小 无警告
__kindof
//__kindof 告诉编译器可以是NSString 也可能是NSString的子类
-(__kindof NSString*)text;
原生例子 (tableview 去除某个cell)
- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath; // returns nil if cell is not visible or index path is out of range
[tableview cellForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];
NS_ASSUME_NONNULL_END
在这两个之间必须属性赋值不可以为空
null_resettable 允许set为空 get不为空 需要重写set 方法
@property(null_resettable,strong,nonatomic)NSMutableArray * allDetailData;
@property(null_resettable,strong,nonatomic)NSMutableArray * allDetailData;
nonnull 属性赋值不可以为空 相反nullable可以
@property(nonnull,strong,nonatomic)NSMutableArray * allDetailData;
泛型
可以是设置一些集合中的数据赋值添加对象的属性
@property(strong,nonatomic)NSArray<NSString*>*explainArray;//警告只能为字符串这个的好处就是在得到数据的可以直接得到数组
@property(nonatomic,strong)NSDictionary<NSString*,NSNumber*> *dic ;key 是字符串 value 是number
自定义泛型
#import <Foundation/Foundation.h>
@interface car<ObjectType>: NSObject
-(void)add:(ObjectType)name;
@end
__covariant 小类型转大类型
__contravariant 大变小 无警告
__kindof
//__kindof 告诉编译器可以是NSString 也可能是NSString的子类
-(__kindof NSString*)text;
原生例子 (tableview 去除某个cell)
- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath; // returns nil if cell is not visible or index path is out of range
[tableview cellForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];
相关文章推荐
- iOS开发系列--通知与消息机制
- iOS 开发隐藏导航栏代码
- iOS 汉字转拼音
- iOS真机调试
- iOS客户端 Openfire服务 利用XEP-0065和XEP-0096 做out-of-band bytestream文件传输
- iOS绘图教程
- Nagios--运维监控软件--简易安装与配置(已经在信工服务器实现)
- runtime-ios
- ios、安卓和后台之间的统一加密方式(DES3加密)
- 让iOS工程目录和文件夹保持一致的工具:synx介绍
- 让iOS工程目录和文件夹保持一致的工具:synx介绍
- iOS 数据请求的是年月日时分秒 cell只取年月日
- iOS 银联支付
- iOS多线程编程——GCD与NSOperation总结
- iOS 多线程--NSThread
- iOS之下拉框实现
- iOS热更新,JSPatch初探
- IOS9新特性之Contacts联系人
- 《Motion Design for iOS》(十)
- iOS项目中常用第三方库超全总结