ios - UIAlertView not firing, after UIActionSheet is displayed -


i have been searching high , low answer issue. see have uiactionsheet , firing off when user tries press button aren't supposed to: works great, trying fire of uialert letting user know current operation has been stopped , need press "continue" ... problem in - (void) actionsheet .... either method not called actionsheet or buttonindex not set correctly.

.h

#import <uikit/uikit.h>  @interface dvrremote : uiviewcontroller <uiactionsheetdelegate> @property (nonatomic) bool pwroff; @property (nonatomic) bool dvrstate; @property (nonatomic) bool playstate; @property (nonatomic) bool rcdstate; @property (nonatomic) bool rcdplay; @property (strong, nonatomic) iboutlet uiswitch *pwrswitch; @property (strong, nonatomic) iboutlet uitextfield *dvrstatelbl; @property (strong, nonatomic) iboutlet uitextfield *pwrlbl; - (ibaction)buttonpressed:(uibutton *)sender; - (ibaction)pwrpressed:(uiswitch *)sender; @end 

and here code uiactionsheet , uialertview ... please help. work 2 weeks overdue.

.m

-(ibaction)buttonpressed:(uibutton*)sender {     if (_pwroff == no)     {         if (_rcdplay == no)         {             if ([sender.currenttitle isequal: @"play"])             {                 _dvrstatelbl.text = @"playing";                 _playstate = yes;                 _rcdstate = no;             }         }         else         {             uiactionsheet *actionsheet = [[uiactionsheet alloc] initwithtitle:@"play not allowed during record" delegate:nil cancelbuttontitle:@"cancel" destructivebuttontitle:@"continue" otherbuttontitles:nil];             [actionsheet showinview: self.view];         }     } }  -(void)actionsheet:(uiactionsheet*)actionsheet diddismisswithbuttonindex:(nsinteger)buttonindex {     if (buttonindex != [actionsheet cancelbuttonindex])     {         uialertview *alert = [[uialertview alloc] initwithtitle:@"playing" message:[nsstring stringwithformat:@"recording stopped"] delegate:self cancelbuttontitle:@"ok"  otherbuttontitles:nil];         [alert show];     } } 

please note: have coded alert under every buttonindex == 0, == 1, == 2 ... not want show.

big can help! regards,

you need set delegate view controller (the object want receive action sheet delegate methods) via:

uiactionsheet *actionsheet = [[uiactionsheet alloc] initwithtitle:@"play not allowed during record"      delegate:self      cancelbuttontitle:@"cancel"      destructivebuttontitle:@"continue"      otherbuttontitles:nil]; 

Comments