Matte.Car
Matte.Car

Reputation: 2027

How to manage a BOOL variable?

I'm using a variable "volume"

@property BOOL * volume;

to set Volume On (YES) or Off (NO)

- (IBAction)manageVolume:(UIButton *)sender {
    if (_volume == TRUE) {
        _volume = !_volume; 
//      code...
    } else {
        _volume = !_volume;
//      code...
        }
    }

It Works but it return three alerts:

How can I solve? Thank you!

Upvotes: 2

Views: 3745

Answers (1)

Wain
Wain

Reputation: 119031

Your property definition is wrong. It should not be a pointer to a BOOL, it should just be a BOOL:

@property BOOL volume;

Upvotes: 16

Related Questions