iphone - How do I call and app deletage method (which uses an alertview) and get the value in view controller after the events? -


i'm calling method i've written in app delegate calls alertview ask user password, use method in applicationwillenterforeground also.

so value set in clickedbuttonatindex in app delegate.

how determine when value has been set in view controller (where i'm calling method) ?

the simplest way delegate viewcontroller.

your app delegate have ability access pointers viewcontrollers/navcontrollers have. (scope depends on design of course)

here post on objective-c delegates.

i found myself doing kind of thing quite simplify process had method contained in singleton called 'toolbox' went this.

-(void)showalertwithtitle:(nsstring*)_title message:(nsstring*)_message cancelbuttontitle:(nsstring*)_canceltitle alternitivebuttontitle:(nsstring*)alternitivebuttontitle anddelegate:(id)del { uialertview *alert = [[uialertview alloc] initwithtitle:_title message:_message  delegate:del cancelbuttontitle:_canceltitle otherbuttontitles:alternitivebuttontitle, nil];  [alert show]; [alert release]; } 

this meant call alert wanted , have alert delegate wanted, implement uialertviewdelegate there.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -