ViewController viewControllers:发送到实例的无法识别的选择器

时间:2013-02-12 04:45:14

标签: ios

要求如下:ViewController(嵌入图像并使其像标签栏一样工作) - > SplitViewController->(1)MasterViewController->(2)DetailViewController。

我在这里遗漏了一些错误原因:

ViewController viewControllers: unrecognized selector sent to instance

我的AppDelegate如下:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    UISplitViewController splitViewController = (UISplitViewController )self.window.rootViewController; 
    UINavigationController *navigationController = [splitViewController.viewControllers lastObject]; 
    splitViewController.delegate = (id)navigationController.topViewController; return YES;
 } 

然后我想按照以下方式准备我的segue:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{ 
    if([segue.identifier isEqualToString:@"HomeSegue"] 
    || [segue.identifier isEqualToString:@"HeartSegue"] 
    || [segue.identifier isEqualToString:@"CogSegue"])
    { 
        for (int i=0; i<[self.buttons.subviews count];i++) 
        { 
            UIButton *button = (UIButton *)[self.buttons.subviews objectAtIndex:i]; 
            [button setSelected:NO]; 
        }
        UIButton *button = (UIButton *)sender;
        [button setSelected:YES];
    } 
} 

在我的详细视图中,我有分割视图控制器的控制器 -

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    self.detailViewController = (klViewController *) 
    [[self.splitViewController.viewControllers lastObject] topViewController]; 
} 

0 个答案:

没有答案