English 中文(简体)
• 如何增加一名导航主计长,并配备Interface Buildinger?
原标题:How to add a Navigation Controller with Interface Builder?

1. Step: Create a new UIViewController:
- Xcode -> New File... -> Cocoa Touch Class -> UIViewController
- Name: MyViewController

2。 Drag和将图书馆的“海军主计长”改为MyViewController。

“alt

3.Step: I m sure, I have to do something to connect the Navigation Controller correctly, isn t it?

4.Step: 着手设立新的观点主计长,作为示范方言:

MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
NSLog(@"navContr: %@", myViewController.navigationController);
[self.navigationController presentModalViewController: myViewController animated:YES]; 

成果:“无”

5.Step: 你可以看到新的模式观点(MyViewController),但没有航海主计长,也没有UINavigation Bar。

非常感谢你们的帮助!


<>>>>>

6.Step: I set a new UIViewController (ViewNavi2) as "Root View Controller":
alt text

7.Step: 我在MyViewController and configure the xib: Navigationller ->Links -> Referencing Outlets

但是,我的航海主计长仍然没有:

MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
NSLog(@"navContr: %@", myViewController.navigationController);
// -> "navContr: nil"
最佳回答

我还希望将导航控制器列入美国国家银行的档案,但所有 Apple果文件都说,“并非最佳”而没有实际解释如何做到。 我希望我的主刺窗能够把包含典型导航控制的一种模式窗口放在一边,而不按方案界定导航控制器。 我赞同我是如何这样做的。

你的代码与地雷非常相似,因为我也定义了<代码>。 IBOutlet UINavigationController *navigationController in MyViewController. 从Interface Buildinger来看,我只是从根基的角度界定了我的看法,并确定了文件所有权和“优势”;对这一观点的定义的看法。

同你的法典一样,我还在我的父母窗口中做了以下工作:

MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
[self presentModalViewController:myViewController animated:YES];

(我打电话给ModelViewController自封,我不知道你为什么有<条码>。 在我测试时,结果是,我的意见从国家银行的档案中载到,但航行条码缺失。 我在《意见》中另有一条法典规定:

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setView:myNavigationController.view];

}

我在此做的是,我的意见是,要向我的纳吉斯冷却队提出看法,其中包含国家银行档案中确定的所有内容,包括导航控制员。

问题回答

看看XCode关于“基于航行的申请”的模板。 (新项目――>导航应用) 然后,在Interface Buildinger打开Maindow.xib。 虽然这不是一种观点,但认为它是你逐步形成的控制者 1. 导言 然后看看看看监察员提到的“名册主计长”,看看看它如何与特工检查员的“名册主计长”和身份检查员的“RootViewController”类别联系起来。

你想把你想要在你的“RootViewController”版本中显示的内容放在你航行的根基上。 典型的情况是,下台的控制器是“详细观察台”。 同样,通过模板提供的示范守则阅读,你将研究如何开始这项工作。 参看以下评议代码:didSelectRowAtIndexPath。 您将需要创建自己的观点控制员,担任《详细意见》主计长。

希望你能看到这一点。

//EDITS based on your Comment//
The Apple docs say that if you want to use IB to make your Navigation controllers you should really put them in your MainWindow.xib. I was tinkering with the fact that you cannot have the NavigationController as a subview of your UIView object. What you can do given where you ve started from is to use IB to add a Navigation bar object to your view controller and then control things from there.

From the Apple documentation "Although you could also load standalone or modally presented navigation controllers from your main nib file (or any other nib file), doing so is not optimal. In those scenarios, it is usually easier to create the navigation controller programmatically at the point of use."

//MORE EDITS// In XCode4 the project template is now called a "Master Detail" project. This is because it will be set up as a split view controller in iPad but still a regular navigation project in iPhone. Where I reference "RootViewController" in the answer, you will now find something called "MasterViewController"

下一个法典不会给你任何有效对象。

NSLog(@"navContr: %@", myViewController.navigationController);

原因是,国际航海巡航员的航行财产





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...