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

MythicFrost

macrumors 68040
Original poster
Mar 11, 2009
3,944
40
Australia
Hi,

I'm wondering if this is the correct way one would display a UITableView with bookmarks/history, etc.

My application is a View-Based application and in my viewDidLoad method I have this code:

Code:
    BookmarksViewController *bc = [[BookmarksViewController alloc] initWithNibName:@"BookmarksViewController" bundle:nil];
    bc.title = @"Bookmarks";

    //Pass any variables to it here, I.E: bc.isiPhone = isiPhone;
    
    bookmarksNavi = [[UINavigationController alloc] initWithRootViewController:bc];
    bookmarksNavi.toolbarHidden = NO; 
    bookmarksNavi.modalTransitionStyle = UIModalTransitionStylePartialCurl;
    
    UIBarButtonItem *bar = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done_TouchUpInside)];
    bookmarksNavi.navigationBar.topItem.rightBarButtonItem = bar;
    
    UIBarButtonItem *newFolder = [[UIBarButtonItem alloc] initWithTitle:@"New Folder" style:UIBarButtonItemStyleBordered target:self action:nil];
    UIBarButtonItem *newBookmark = [[UIBarButtonItem alloc] initWithTitle:@"New Bookmark" style:UIBarButtonItemStyleBordered target:self action:nil];
    UIBarButtonItem *flex = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
    
    NSArray *array = [[NSArray alloc] initWithObjects:bc.editButtonItem, flex, newFolder, newBookmark, nil];
    [bc setToolbarItems:array animated:YES];

As you can see I create the local variable BC and initialise my global variable bookmarksNavi with it as its root view controller. And, whenever I want to show my bookmarks view I do:

Code:
[self presentModalViewController:bookmarksNavi animated:YES];

I'd just like to know I'm doing this the right way, if not, I'd like to fix it before I pile a heap of code on top of it.

Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.