学习ios编程,请澄清为什么对布尔类型的引用会给我一个警告,但使用布尔类型的属性创建的变量不会有任何警告?
@property (nonatomic) BOOL *userTyped; //-> userTyped is pointer to BOOL type
-(IBAction) button:(UIButton *)sender {
self.userTyped = YES; //-> will give a warning saying assigning char to BOOL
}
@property (nonatomic) BOOL userTyped; //-> userTyped acts as variable of BOOl type
-(IBAction) button:(UIButton *)sender {
self.userTyped = YES; //-> this will not give warning.
}
谢谢你。