开发者

how to push one view to another view?

开发者 https://www.devze.com 2022-12-24 13:48 出处:网络
In my application there are two view.First view na dsecond view. In my second view there is one time for 60 sec.When i go first view to second view then timr is start.when i back to first view thne ti

In my application there are two view.First view na dsecond view. In my second view there is one time for 60 sec.When i go first view to second view then timr is start.when i back to first view thne timer is running in background.when timer is over then one popup is generated.When i click o开发者_如何学运维n pop up(ok button) then i want to go in second view.Acctully pop is in second view.

How to solve this problem


Do you use an UIAlertView as your popup?

If yes, your view controller has to be conform to the UIAlertViewDelegate protocol and you can implement the alertView:clickedButtonAtIndex: method in order to react to the button you clicked in the popup. Then you can push your view to the other.


in your View1... before you change your view from view1 to view2 put this line

[self performSelector:@selector(Method1) withObject:nil afterDelay:60]; 

it will call this method after 60 second in view2 keep one boolean variable... BoolAlert and set it in Method1 function write something like

-(void) Method1
{
View2viewController *view2 = [[ View2viewController alloc] initWithNibName:@"View2viewController" bundle:nil];
view2.BoolAlert = TRUE;
[self.navigationController pushViewController:view2 animated:YES];
        [view2 release];


}

in view2's viewDidLoad method write

- (void)viewDidLoad {
    [super viewDidLoad];
if(BoolAlert)
{
//show alert here 
}
}
0

精彩评论

暂无评论...
验证码 换一张
取 消