开发者

Iphone Back button help

开发者 https://www.devze.com 2023-03-15 02:17 出处:网络
Hi guys i am trying an app this is my link http://web.missouri.edu/~dnk6y2/Shealth%20app/ 1.when i click on a annotation it will go inti an another view when i click show bulding it pop back the same

Hi guys i am trying an app this is my link http://web.missouri.edu/~dnk6y2/Shealth%20app/

1.when i click on a annotation it will go inti an another view when i click show bulding it pop back the same view with single annotation and the code iam using for this is

-(void)viewWillAppear:(BOOL)animated
{
    if ((i%2==0)) {
        [mapView addAnnotations:djObjects];
        i++;
    }
    else
    {
        if((show1==YES))

            [mapView addAnnotation:annotation];
        else
  开发者_JAVA百科          [mapView addAnnotations:djObjects];

        //        i++;
    }

}

the app is working fine when i press back button even it is showing one annotation where i need all the annpotaions to come down....

so my question is can i set an action to an back button i have gone thru the apple documentation but i have no clue...


I assume that you're using a UINavigationController. UINavigationBarDelegate is the delegate class and it implements -navigationBar:shouldPopItem. You can put the action you want to trigger in that method.

Alternately, you can put it in -viewWillDisappear after checking that the view is disappearing because it was popped from the stack:

-(void) viewWillDisappear:(BOOL)animated {
    if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
       // action code here
    }
    [super viewWillDisappear:animated];
}
0

精彩评论

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