Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-10-2010, 09:45 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Roma, Italia
Posts: 2
umpire274 is on a distinguished road
Send a message via MSN to umpire274 Send a message via Yahoo to umpire274 Send a message via Skype™ to umpire274
Default Navigation Bar overwritten by UITableViewController

Hi all.

I'm newbie in iPhone development and then sorry for my problem so simple.

I've a project 'window-based application' and I've added an UITabBarController into my application delegate and all done.

One of my tab is an UITableViewController that must contain one NavigationBar.
I've added in 'viewDidLoad' method but there are some problems.

You can see in png attached.

This are the code of UITableViewController.

LibraryTableviewController.h
Code:
#import <UIKit/UIKit.h>


@interface LibraryTableViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
    NSDictionary *books;
    NSArray *keys;
}

@property (nonatomic, retain) NSDictionary *books;
@property (nonatomic, retain) NSArray *keys;
@end
LibraryTableViewController.m
Code:
- (void)viewDidLoad {
    [super viewDidLoad];

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
    UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:self] autorelease];
    navController.navigationBar.barStyle = UIBarStyleBlackOpaque;
    [self.view addSubview:navController.view];
    
    NSString *path = [[NSBundle mainBundle] pathForResource:@"bookslistsorted" ofType:@"plist"];
    NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
    self.books = dict;
    [dict release];
    
    NSArray *array = [[books allKeys] sortedArrayUsingSelector:@selector(compare:)];
    self.keys = array;
}
Can anyone help me?

Thank's,
Alex.
Attached Images
File Type: jpg UITableViewController-error.jpg (9.1 KB, 1 views)
umpire274 is offline   Reply With Quote
Old 09-10-2010, 12:52 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Long Beach, CA
Posts: 612
bytor99999 is on a distinguished road
Send a message via AIM to bytor99999 Send a message via Yahoo to bytor99999
Default

Um, wouldn't you create the NavController before even creating the rootController instance.

You create your TableView first, then in its load you then create your navController.

The navController is responsible for showing the table.

So in the code before you create your tableview, create your navController add the tableView to it like you just did, then add the navController.view as the view to add rather than the tableView, which you did.

Basically all in the code that you didn't post. The one right before what you posted gets called.

Mark
__________________
Perfect World Programming LLC
http://www.perfectworldprogramming.com

Please check out my apps.

TubeOrganizer
http://www.spritzlerapps.com/tube-organizer.html

Paper Clips
http://spritzlerapps.weebly.com/paper-clips.html
bytor99999 is offline   Reply With Quote
Old 09-13-2010, 07:42 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Roma, Italia
Posts: 2
umpire274 is on a distinguished road
Send a message via MSN to umpire274 Send a message via Yahoo to umpire274 Send a message via Skype™ to umpire274
Default

Quote:
Originally Posted by bytor99999 View Post
...
So in the code before you create your tableview, create your navController add the tableView to it like you just did, then add the navController.view as the view to add rather than the tableView, which you did.
...
Mark
Thank's Mark. I'll try very soon.

Alex.
umpire274 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 326
9 members and 317 guests
bignoggins, carlandrews, flamingliquid, hzwegjxg, ilmman, jenniead38, linkmx, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:52 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0