Reputation: 329
I've been making an App completely programmatically, but I would like to add some more buttons etc.
Currently my main view is a full-screen TableView. I would like to load a UIView (from a NIB) which has some buttons / labels and my curreny TableView in the middle (full width) with sort of a header and footer with my buttons / labels.
(Since I suspect that changed need to be made here...) My AppDelegate currently has the following code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
AFViewController *viewController = [[AFViewController alloc] initWithStyle:UITableViewStylePlain];
//AFViewController *viewController = [[AFViewController alloc] initWithNibName:@"mainView" bundle:nil];
self.viewController = [[UINavigationController alloc] initWithRootViewController:viewController];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
Upvotes: 0
Views: 102
Reputation: 137
Why don't you create the desired structure in one nib itself? Create a nib with view controller. On the nib place your buttons and tableview as per your layout. Interface builder is intended to reduce your coding effort when it comes to design so use it. Make sure to make your new view controller as the root controller in app delegate.
Upvotes: 0
Reputation: 12717
You need to create a UIViewController
instead of UITableViewController
. You can easily do in your current AFViewController
which actually a UITableViewController
, just follow these steps
AFViewController.h
change UITableViewController
to
UIViewController
. UIView
from controls.UITableView
inside UIView
.File Owner
connect view
to the UIView
and create IBOutlet for the UITableView
inside the UIView
.Thats it you are ready to go.. And at last..
AFViewController *viewController = [[AFViewController alloc] initWithNibName:@"AFViewController" bundle:nil];
Upvotes: 1