ios - UIAlertView clickedButtonAtIndex method is not called -


in .h file

@interface menuviewcontroller : uiviewcontroller<uialertviewdelegate> 

in .m file

@interface tacdiymenuviewcontroller ()  @end  @implementation tacdiymenuviewcontroller  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }  - (void)viewdidload {     [super viewdidload]; }  - (void)viewwillappear:(bool)animated{     [super viewwillappear:animated]; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  - (nsinteger)numberofsectionsincollectionview:(uicollectionview *)collectionview{     return 1; }  - (nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsinsection:(nsinteger)section{     return [self.imageviews count]; }  - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath{     cgsize size = cgsizemake(200, 100);     return size; }  - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath{     menuviewcell *cell = [collectionview dequeuereusablecellwithreuseidentifier:@"menuviewcellidentifier" forindexpath:indexpath];     if ([indexpath row] < [self.imageviews count]) {         cell.thumbnails.image = [self.imageviews objectatindex:[indexpath row]];     } else {         cell.thumbnails.image = [uiimage imagenamed:@"addmark.png"];     }      return cell; }  - (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath{     [self dosomething]; }  - (void)dosomething{     uialertview* alert = [[uialertview alloc] initwithtitle:@"warning"                                                     message:@"are sure"                                                    delegate:self                                           cancelbuttontitle:@"no"                                           otherbuttontitles:@"yes",nil];     [alert show]; }  - (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex{     if(buttonindex == 0){         nslog(@"0");     } else {         nslog(@"1");     } }  @end 

however,the clickedbuttonatindex not called.how happen?
way, view in menuviewcontroller subview of class, has uialertview , clickedbuttonatindex method. works well.

replace

@interface menuviewcontroller : uiviewcontroller<uialertviewdelegate> 

with

@interface tacdiymenuviewcontroller : uiviewcontroller<uialertviewdelegate> 

then should work.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -