2

我正在使用可变的“音量”

@property BOOL * volume;

设置音量开 (YES) 或关 (NO)

- (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'

我该如何解决?谢谢!

4

1 回答 1

16

你的属性定义是错误的。它不应该是指向 a 的指针BOOL,而应该只是 a BOOL

@property BOOL volume;
于 2013-10-20T12:05:16.777 回答