我正在使用 JTRevealSidebar 并构建了一个带有静态单元格的表格视图控制器,用作我的滑出导航。当我将导航控制器作为开始视图时,我看到了所有表格单元格,因为它们应该是。当我将该视图用作导航的滑出视图时,它是一个空表视图。这是我用来将其设置为侧边栏并显示它的代码。
//This is in the header file
@property (nonatomic, strong) ehrxSideBarController *leftSidebarViewController;
//Then in the implementation file
@synthesize leftSidebarViewController = _leftSidebarViewController;
- (UIView *)viewForLeftSidebar {
CGRect viewFrame = self.navigationController.applicationViewFrame;
UITableViewController *controller = self.leftSidebarViewController;
if ( ! controller) {
self.leftSidebarViewController = [[ehrxSideBarController alloc] init];
self.leftSidebarViewController.sidebarDelegate = self;
controller = self.leftSidebarViewController;
controller.title = @"LeftSidebarViewController";
}
controller.view.frame = CGRectMake(0, viewFrame.origin.y, 270, viewFrame.size.height);
controller.view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
return controller.view;
}
我确保在我的故事板中,视图具有与之关联的正确控制器类。