Max Ng
Max Ng

Reputation: 162

How to add a new custom UIViewController in IOS

I'm a new guy in this field

and i have a problem when i addSubView in AppDelegate

i have a Custom Controller look like this:

@interface mainViewController : UIViewController <UITableViewDelegate> 
{
    UITabBarController *myTad;
    UITableView *myTable;
    aModel *myModel
    // ......
}
//Some methods and @property

All i want is make a View Controller that gets other Controller also connect to the model. this is the place work all the things

and in AppDelegate i added in proper way.

[window addSubview: myController.view];
[window makeKeyAndVisible];
return YES

but its just didn't work ?

The Problem is loadView, the method i overWrite in mainViewController implement not do anythings. It's just go through

didn't i miss something?

Upvotes: 0

Views: 226

Answers (2)

lohiaguitar91
lohiaguitar91

Reputation: 522

Use a UINavigationController to control and 'connect' your views. This will allow you to push them properly and navigate back via back button.

Upvotes: 0

Matt Meyers
Matt Meyers

Reputation: 143

You need to push your new view controller onto the stack, like so:

[self.navigationController pushViewController:myController];

Upvotes: 2

Related Questions