I am working on my first real iPhone app. This app has a bookmark menu item in a toolbar, just like in safari. Hitting the bookmarks menu in safari presents a modal view, which slides up from under the toolbar. The items on the toolbar themselves are replaced by a "Edit" item. The navigation bar (with a "done" button) slides up with the new view.
I am trying to replicate this behavior.
This starts by creating a new UIViewController, and then displaying it.
First attempt to present view modally:
The view slides in from the side.
Second attempt:
The bookmarksview slides in from the bottom, but covers the toolbar while doing so. When it reaches the top, the toolbar added in IB to the bookmarksview becomes visible.
Third attempt: with an intermediate UINavigationController
Same outcome as in attempt 2.
Fourth attempt:
This just shows the view, and incorrectly positioned as well. The latter can probably be fixed via the frame of the view.
Thanks for reading.
All suggestions on how to replicate Safari's behavior are welcome.
I am trying to replicate this behavior.
This starts by creating a new UIViewController, and then displaying it.
Code:
BookmarksViewController *bookmarksViewControl = [[BookmarksViewController alloc] initWithNibName:nil bundle:nil];
First attempt to present view modally:
Code:
[[self navigationController] pushViewController:bookmarksViewControl
animated:YES];
Second attempt:
Code:
[[self navigationController] presentModalViewController:bookmarksViewControl animated:YES];
Third attempt: with an intermediate UINavigationController
Code:
UINavigationController* theNavController = [[UINavigationController alloc] initWithRootViewController:bookmarksViewControl];
[theNavController setToolbarHidden:NO];
[[self navigationController] presentModalViewController:theNavController
animated:YES];
Fourth attempt:
Code:
[[[self navigationController] view] addSubview:[bookmarksViewControl view]];
Thanks for reading.
All suggestions on how to replicate Safari's behavior are welcome.