2012-09-13 13 views
0
- (void)ItemPressed:(id)sender { 
    NSInteger index = [self.tabBarItems indexOfObject:sender]; 
    BOOL shouldSelect = [self delegatedDecisionIfWeShouldSelectViewController:[self.viewControllers objectAtIndex:index] atIndex:index]; 

    if (shouldSelect) { 
     if (index != self.selectedIndex) { 
      self.selectedIndex = index; 
     } else { 
      if ([self.selectedViewController isKindOfClass:[UINavigationController class]]) { 
       UINavigationController *navigationController = (UINavigationController *)self.selectedViewController; 

       [navigationController popToRootViewControllerAnimated:YES]; 
      } 
     } 
    } 
} 

嗨,我創建tabbarcontroller框架所有做工精細用源但同時選擇一個索引到另一個未捕獲的異常: - {WebDataSource的indexOf:]:無法識別選擇同時使用框架

創建框架得到錯誤

-{WebDataSource indexof:]: unrecognized selector instance 我得到了上述錯誤。

有什麼想法?

我宣佈的TabBar的項目,如下面

vc1 = [[webviewname alloc] initUrl:[NSURL URLWithString:@"https://www.google.com"]]; 
    vc2 = [[webviewname alloc] initUrl:[NSURL URLWithString:@"https://www.yahoo.com"]]; 

    vc1.O_tabBarItem = [OTabBarItem itemWithTitle:@"index" image:[UIImage imageNamed:@"index"]]; 
    vc2.O_tabBarItem = [OTabBarItem itemWithTitle:@"index" image:[UIImage imageNamed:@"index"]]; 


    vc1.delegate=self; 
    vc2.delegate=self; 

    NSArray *vControl = [NSArray arrayWithObjects:vc1,vc2,nil]; 

回答

0

我希望你的預期self.tabBarItems是一個NSArray對象。但是在這裏,對象引用了其他一些實例,例如WebDataSource

是否有可能顯示,您如何聲明和填充數組tabBarItems

+0

嗨添加源請檢查它 –

+0

但是,在哪裏添加了按鈕的操作? – Ilanchezhian

相關問題