Mat*_*Car 2 int boolean objective-c ios
我正在使用变量"音量"
@property BOOL * volume;
Run Code Online (Sandbox Code Playgroud)
设置音量开(是)或关(否)
- (IBAction)manageVolume:(UIButton *)sender {
if (_volume == TRUE) {
_volume = !_volume;
// code...
} else {
_volume = !_volume;
// code...
}
}
Run Code Online (Sandbox Code Playgroud)
它工作但它返回三个警报:
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'
我怎么解决?谢谢!
Wai*_*ain 16
您的属性定义错误.它不应该是指向a的指针BOOL,它应该只是一个BOOL:
@property BOOL volume;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3364 次 |
| 最近记录: |