【发布时间】:2011-07-24 23:15:18
【问题描述】:
我有 3 个独立的视图控制器,它们都有自己的 NIB 文件。
我的应用中有一个概览视图,其中包含一个可以切换的分段控件。与其复制所有这 3 个视图的方法并将它们放入此概览的类中,是否可以仅将每个视图加载为概览视图的子视图,加深选择哪个段?
- (void)segmentedControl:(SVSegmentedControl*)segmentedControl didSelectIndex:(NSUInteger)index
{
switch (index)
{
case 0:
{
MusclesTableViewController *musclesTableViewController = [[MusclesTableViewController alloc] initWithNibName:@"MusclesTableViewController" bundle:nil];
[self.view addSubview: musclesTableViewController];
[musclesTableViewController release];
}
break;
case 1:
// load second nib and add it as a subview
break;
default:
break;
}
}
【问题讨论】:
标签: iphone objective-c cocoa-touch uiviewcontroller