ios - If statement on UIButton selection -


im not sure why not working:

- (ibaction)slidervaluechanged:(uislider *)sender {     if (_menurightitem2.selected == yes) {         nslog(@"yes");         if (sender == self.slider1)             [sender setvalue:((int)((slider1.value + 1) / 1.0) - 1.0) animated:no];         else if (sender == self.slider2)             [sender setvalue:((int)((slider2.value + 1) / 1.0) - 1.0) animated:no];     }     barheight = slider1.value * -20 + slider2.value * -50; //! hoogte in de min, yea right.     [uiview animatewithduration:0.50 animations:^{         self.orangeview.frame = cgrectmake(595, 615, 80, barheight);     }]; } 

what i'm trying accomplish when menurightitem2 selected executes if else statement , otherwise not. nslog() isn't working. correct way achieve this?

my button statement:

- (ibaction)menurightitem2touch:(id)sender {     _menurightitem2.selected = !_menurightitem2.selected; } 

[_menurightitem2 isselected] returns bool

you can directly use method in if statement, recommended way it, rather equating yes

so try , use

if([_menurightitem2 isselected]){  } 

hope helps.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -