I have added a navigation controller in iphone app from my home screen it takes to a tableview from the table view it takes to the detail.I am able to navigate between the views back and forth.what I want is navigate directly from detail view to my home screen.Is there any possibility to do that?
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.hidesBackButton = TRUE;
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; self.navigationItem.leftBarButtonItem = saveButton;
id1 = [[NSUserDefaults standardUserDefaults] valueForKey:@"id1"];
theTitle = [[NSUserDefaults standardUserDefaults] valueForKey:@"theTitle"];
self.title=theTitle;
NSLog(@"hi %@", id1);
hello=@"hello";
NSLog(@"ahhhha sdfgs :%@",theTitle);
urlAddress = [NSString stringWithFormat:@"http://dev-parkguiden.knutpunkten.se/Api/GetPark?parkid=%@",self.id1];
baseURL =[[NSURL URLWithString:urlAddress]retain];
jsonData=[NSData dataWithContentsOfURL:baseURL];
NSDictionary *items=[NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:nil];
boom=[items objectForKey:@"description"];
latitude=[items objectForKey:@"latitude"];
longitude=[items objectForKey:@"longitude"];
NSLog(@"retard:%@",latitude);
NSLog(@"retard:%@",longitude);
NSString *html = [NSString stringWithFormat:@"<html><body><p>%@</p></body></html>", boom];
[self.webview loadHTMLString:html baseURL:nil];
[[NSUserDefaults standardUserDefaults] setValue:latitude forKey:@"lat"];
[[NSUserDefaults standardUserDefaults] setValue: longitude forKey:@"lot"];
[[NSUserDefaults standardUserDefaults] setValue: theTitle forKey:@"title"];
}
you have to just set custom back button and set button click event
// hide back button first