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 07-19-2011, 08:22 PM   #1 (permalink)
Newcomer
 
Join Date: Jun 2011
Location: Caguas, PR
Age: 18
Posts: 46
RomanRobot is on a distinguished road
Smile Work around to Xcode 4 NIB Name drop-down not populating

I'm pretty sure the few of you using Xcode 4 have encountered the same problem. I want to know what work around people have been using, since this is a huge problem.

Last edited by RomanRobot; 07-20-2011 at 06:00 PM.
RomanRobot is offline   Reply With Quote
Old 07-20-2011, 06:00 PM   #2 (permalink)
Newcomer
 
Join Date: Jun 2011
Location: Caguas, PR
Age: 18
Posts: 46
RomanRobot is on a distinguished road
Default

For those of you who don't know what I'm talking about:
Let's say for example I am to create a UINavigationController in the NIB. Now I expand it to show the Root View Controller of the UINavigationController. I click the Root View Controller so I can point it to an existing NIB file I've already made in the Attributes Inspector. When I click the NIB Name drop-down list, nothing. It's empty. I've tried cleaning the targets and a whole bunch of other stuff, but how would I set the Root View Controller of the Navigation Controller programmatically?
RomanRobot is offline   Reply With Quote
Old 07-20-2011, 07:08 PM   #3 (permalink)
Newcomer
 
Join Date: Jun 2011
Location: Caguas, PR
Age: 18
Posts: 46
RomanRobot is on a distinguished road
Default

Quote:
Originally Posted by RomanRobot View Post
For those of you who don't know what I'm talking about:
Let's say for example I am to create a UINavigationController in the NIB. Now I expand it to show the Root View Controller of the UINavigationController. I click the Root View Controller so I can point it to an existing NIB file I've already made in the Attributes Inspector. When I click the NIB Name drop-down list, nothing. It's empty. I've tried cleaning the targets and a whole bunch of other stuff, but how would I set the Root View Controller of the Navigation Controller programmatically?
So I answered my own question once again. :P

I just had to import the class at the top of the App Delegate's implementation file
Code:
#import "RootViewController.h"
in the application:didFinishLaunchingWithOptions: I just had to create the RootViewController object and init the navigation controller with it.
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    RootViewController *navigationRootViewController = [[RootViewController alloc] init];
    [navigationController initWithRootViewController:navigationRootViewController];
    
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;
}
There's only one anomaly with my solution. When I run it, it shows the RootViewController as a detail view and the back button says Root View Controller

which when pressed goes to the... RootViewController. The same thing.

Any ideas how I could make it not start in a detail view with the same thing?
RomanRobot is offline   Reply With Quote
Old 07-20-2011, 07:46 PM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Code:
[navigationController initWithRootViewController...
You can't (or at least, shouldn't) take an existing object and init it again. The only thing that should be immediately to the left of an init* method is [WhateverClass alloc].

So it would seem that what you've accomplished is to push another view controller on the stack. Since you did a bad thing to start with, I'd say that this is probably falling into the realm of "the behavior when you do this is undefined."

I'm not entirely sure that I understand the complaint, but I can't honestly say that I've ever seen the NIB Name menu contain anything useful. Or at all. But it isn't really necessary anyway. If you go to the Identity inspector (3rd from left in Xcode 4), there you can specify your custom class. Just define this, and then you can leave the NIB Name selection blank. The only 3-vs-4 difference I've seen with the Class menu is that 4 seems to be case-sensitive, where 3 was not.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 07-20-2011, 08:27 PM   #5 (permalink)
Newcomer
 
Join Date: Jun 2011
Location: Caguas, PR
Age: 18
Posts: 46
RomanRobot is on a distinguished road
Default

For some reason it doesn't work on a sample project with a table view controller instead of a view controller that I made for a tutorial. I tried it in my main project though and it worked. Ah well, spot on! Thanks again! ^.^
RomanRobot is offline   Reply With Quote
Reply

Bookmarks

Tags
drop down, drop-down, navigation controller, uinavigationcontroller, xcode 4

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: 412
16 members and 396 guests
7twenty7, blasterbr, buggen, Clouds, dre, EvilElf, HemiMG, jeroenkeij, jimmyon122, jonathandeknudt, LEARN2MAKE, Mah6447, n00b, nyoe, pungs, UMAD
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,668
Threads: 94,121
Posts: 402,901
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jonathandeknudt
Powered by vBadvanced CMPS v3.1.0

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