objective c - iOS 8.3: Alert View Cancel Button not responding in AppDelegate -
i working on project in ios 8.3 in xcode 6.3.2, have placed alertview
in appdelegate
class when web service returns error, when trying click cancel button on simulator, not responding. facing same error?
below code:
uialertview *alertfailure = [[uialertview alloc] initwithtitle:@"error occured" message:@"something went wrong" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alertfailure show];
edit 1: added delegate method on request
- (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex { // user clicked ok if (buttonindex == 0) { // here... alertview.hidden = yes; } }
edit 2: not sensing delegate
appdelegate.h
@interface appdelegate : uiresponder <uiapplicationdelegate, cllocationmanagerdelegate, uialertviewdelegate>
you have implement following delegate method in application.
- (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex;
here whenever click on cancel button work without problem. seems have set delegate uialertview.
please let me know if still face issue.
Comments
Post a Comment