Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MrFusion

macrumors 6502a
Original poster
Jun 8, 2005
613
0
West-Europe
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.
Code:
BookmarksViewController *bookmarksViewControl = [[BookmarksViewController alloc] initWithNibName:nil bundle:nil];

First attempt to present view modally:
Code:
[[self navigationController] pushViewController:bookmarksViewControl
									   animated:YES];
The view slides in from the side.

Second attempt:
Code:
	[[self navigationController] presentModalViewController:bookmarksViewControl animated:YES];
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
Code:
UINavigationController*  theNavController = [[UINavigationController alloc] initWithRootViewController:bookmarksViewControl];
	[theNavController setToolbarHidden:NO];
	[[self navigationController] presentModalViewController:theNavController
												   animated:YES];
Same outcome as in attempt 2.

Fourth attempt:
Code:
[[[self navigationController] view] addSubview:[bookmarksViewControl view]];
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.