Reputation: 16851
I need to implement the back button; (as in webpages, when you click the back
button the screen will set focus to the previous screen).
I am not using a navigation control here, instead i want to do this using a Navigation bar
and then adding a navigation button
on it. Now when the user clicks on the navigation button
the previous view
should be displayed.
How should i do this.
My screen looks like this :
When i click on Hello, it should go to the previous screen.
Upvotes: 1
Views: 105
Reputation: 52778
Check out UINavigationController Class Regerence then try something like this:
- (void)pickerCancel {
[self dismissModalViewControllerAnimated:YES];
}
- (void)doSomething {
[myView.navigationItem setBackBarButtonItem:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(pickerCancel)] autorelease]];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:myView];
[navigation setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[navigation setDelegate:self];
[self presentModalViewController:navigation animated:YES];
[myView release];
[navigation release];
}
Upvotes: 2
Reputation: 4678
You really should use a UINavigationController
as that is its entire purpose.
Upvotes: 0