2012-01-16 32 views
-1

這是選中複選框的結果,我需要訪問該方法來阻止所有其他複選框。我無法訪問我的ViewController的這種方法

我收到此錯誤:

-[UIView removeTarget]: unrecognized selector sent to instance 0x6aeded0 
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:'-[UIView removeTarget]: 
unrecognized selector sent to instance 0x6aeded0' 

-(void)checked:(NSNotification *)notif { 
    for (int i = 0; i < [[[[[[[[[self.view.subviews objectAtIndex:2] subviews] objectAtIndex:2] subviews] objectAtIndex:1] subviews] objectAtIndex:4]subviews] count]; i++) 
    { 
     AskViewController *askView = ((AskViewController *)[[[[[[[[[self.view.subviews objectAtIndex:2] subviews] objectAtIndex:2] subviews] objectAtIndex:0] subviews] objectAtIndex:4]subviews] objectAtIndex:i]); 
     [askView removeTarget]; 
    } 

} 
+1

你是什麼意思,你「無法訪問」它?你不能訪問什麼?什麼告訴你你不能?有沒有錯誤信息?如果有的話,你有沒有任何理由像你應該這樣在這裏列出來? – 2012-01-16 20:25:02

+0

[UIView removeTarget]:無法識別的選擇器發送到實例0x6aeded0 終止應用程序由於未捕獲的異常'NSInvalidArgumentException',原因:' - [UIView removeTarget]:無法識別的選擇器發送到實例0x6aeded0' – 2012-01-16 20:31:12

+0

這似乎是一個過於複雜的方式禁用其他複選框在頁面上。依靠子視圖的索引來定位它們的具體集合是有風險的。 – reddersky 2012-01-16 20:35:47

回答

0

你試圖對象(UIView的),不支持該方法上執行removeTarget。