/*
*iOS 9新的关键字 用来修饰属性 或者 方法的参数 方法的返回值
* 只能修饰对象 不能修饰基本数据类型
*nullable 可以为空
*nonnull 不可以为空 非空
*null_resettable get不能返回空 set可以为空
//null_resettable 必须重写get方法 或者set方法, 处理传递的值为空的情况
_Null_unspecified 不确定是否为空
**/
//第一种方式
//@property(nonatomic,strong,nullable)NSArray *dataSoure;
//第二种方式
//@property(nonatomic,strong)NSArray *_Nullable dataSoure;
//第三种方式
@property(nonatomic,strong)NSArray *__nullable datasource;
泛型
#import "NewViewController.h"
@interface NewViewController ()
@property(nonatomic,strong)NSMutableArray<NSString*> *datas;
@end
@implementation NewViewController
/**
泛型 限制类型
泛型使用的场景
1 在集合(数组,字典, NSSet)中使用泛型比较常见
泛型好处
1提高开发的规范 减少程序员之间交流
2通过集合取出对象 直接当做泛型对象使用 可以直接使用.语法
泛型修饰 只能修饰方法的调用
*/
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[super touchesBegan:touches withEvent:event];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
__kindof
#import "KindViewController.h"
@interface KindViewController ()
@end
/**
__kindof :表示当前类 或者它的子类
*/
@implementation KindViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end