我正在使用变量“volume”
@property BOOL * volume;
设置音量开(是)或关(否)
- (IBAction)manageVolume:(UIButton *)sender {
if (_volume == TRUE) {
_volume = !_volume;
// code...
} else {
_volume = !_volume;
// code...
}
}
它可以工作,但它会返回三个警报:
if (_volume == TRUE) {
返回Comparison between pointer and integer ('BOOL *' (aka 'signed char *') and 'int')
_volume = !_volume;
返回Incompatible integer to pointer conversion assigning to 'BOOL *' (aka 'signed char *') from 'int'
我该如何解决?谢谢!
答案 0 :(得分:16)
您的属性定义错误。它不应该是指向BOOL
的指针,它应该只是BOOL
:
@property BOOL volume;