I've been doing everything programmatically in the past, but now I'm trying to learn to use Interface Builder. An experience in and of itself.
My problem is with UISearchDisplayController
. Just dropping it on top of my UITableViewController
(see figure 1) should set up all relevant connections (and I think add it to the tableView
header), and as such it should (?) show up when I run the app. But no! Nothing shows up (see figure 2). Has anyone had any similar experiences, or know what the problem might be?
Figure 1
Figure 2
It's a navigation based app - if that makes any difference - with the navigation part of the app set up programmatically like so:
- (BOOL)application:(UIApplication *)application didFi开发者_C百科nishLaunchingWithOptions:(NSDictionary *)launchOptions
{
bookmarksController = [[BookmarksViewController alloc] init];
bookmarksController.managedObjectContext = [self managedObjectContext];
navController = [[UINavigationController alloc] initWithRootViewController:bookmarksController];
[bookmarksController release];
[self.window addSubview:navController.view];
[self.window makeKeyAndVisible];
return YES;
}
Turns out I had to explicitly point out which NIB to load:
bookmarksController = [[BookmarksViewController alloc] initWithNibName:@"BookmarksViewController" bundle:nil];
in the ViewDidLoad method:
self.searchDisplayController.searchBar.hidden = NO;
if that dosen't help then check all the connections in IB. This a screenshot of the connections of the Files Owner in my tableview xib.
If even this dosen't help, please comment and I will try to figure out something else.
精彩评论