2013-03-06 19 views
4
2013-03-06 17:38:14.764 LiveiPad[506:607] -[NSIndexPath setTableViewStyle:]: unrecognized selector sent to instance 0x57ac40 
2013-03-06 17:38:14.785 LiveiPad[506:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSIndexPath setTableViewStyle:]: unrecognized selector sent to instance 0x57ac40' 
*** Call stack at first throw: 
(
0 CoreFoundation      0x3182564f __exceptionPreprocess + 114 
1 libobjc.A.dylib      0x30229c5d objc_exception_throw + 24 
2 CoreFoundation      0x318291bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102 
3 CoreFoundation      0x31828649 ___forwarding___ + 508 
4 CoreFoundation      0x3179f180 _CF_forwarding_prep_0 + 48 
5 UIKit        0x32a30a11 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 552 
6 UIKit        0x32a3076b -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 34 
7 UIKit        0x32a290cd -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 936 
8 UIKit        0x32a2827d -[UITableView layoutSubviews] + 140 
9 UIKit        0x329d45fb -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26 
10 CoreFoundation      0x31792f03 -[NSObject(NSObject) performSelector:withObject:] + 22 
11 QuartzCore       0x361c5bb5 -[CALayer layoutSublayers] + 120 
12 QuartzCore       0x361c596d CALayerLayoutIfNeeded + 184 
13 QuartzCore       0x361cb1c5 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 212 
14 QuartzCore       0x361cafd7 _ZN2CA11Transaction6commitEv + 190 
15 QuartzCore       0x361c4055 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 56 
16 CoreFoundation      0x317fca35 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16 
17 CoreFoundation      0x317fe465 __CFRunLoopDoObservers + 412 
18 CoreFoundation      0x317ff75b __CFRunLoopRun + 854 
19 CoreFoundation      0x3178fec3 CFRunLoopRunSpecific + 230 
20 CoreFoundation      0x3178fdcb CFRunLoopRunInMode + 58 
21 GraphicsServices     0x365b241f GSEventRunModal + 114 
22 GraphicsServices     0x365b24cb GSEventRun + 62 
23 UIKit        0x329fdd69 -[UIApplication _run] + 404 
24 UIKit        0x329fb807 UIApplicationMain + 670 
25 LiveiPad     0x000024cb main + 158 
26 LiveiPad     0x00002428 start + 40 
) 
terminate called after throwing an instance of 'NSException' 

是否有任何人知道這是爲什麼崩潰? 下面是一些代碼我使用的頁面控制選擇應用程序崩潰的[NSIndexPath setTableViewStyle:]:無法識別的選擇發送到實例在ipad

 CGFloat pageWidth = self.svMinistatementTable.frame.size.width; 
     int page = floor((self.svMinistatementTable.contentOffset.x - pageWidth/2)/pageWidth) + 1; 
     self.pcMinistatementDetail.currentPage = page; 

     CGRect Viewframe = CGRectMake((896*self.pcMinistatementDetail.currentPage), 0, 896, 235); 
     UIView *subview = [[UIView alloc] initWithFrame:Viewframe]; 
     subview.tag=self.pcMinistatementDetail.currentPage; 
     CGRect frameTable= CGRectMake(0, 0, 896, 235); 
     UITableView *tableView= [[UITableView alloc]initWithFrame: frameTable]; 
     tableView.tag=self.pcMinistatementDetail.currentPage; 
     tableView.dataSource=self; 
     tableView.delegate=self; 

     if([strCallingView isEqualToString:@"Account"]) 
     { 
      tableviewMiniStatement=tableView; 

     } 
     else if([strCallingView isEqualToString:@"CreditCard"]) 
     { 
      tableviewCCUnbilledTransaction=tableView; 

     } 
     [subview addSubview: tableView]; 
     [self.svMinistatementTable addSubview:subview]; 
     [tableView reloadData];code here 
+1

顯示您的代碼?沒有人可以幫助只崩潰日誌.. – 2013-03-06 13:06:10

+2

崩潰,因爲你正在使NSIndexpath對象絕對設置表格樣式 – Leena 2013-03-06 13:08:50

+0

。在這裏放置一些相關代碼。 – Ganapathy 2013-03-06 13:09:35

回答

3

正如很多人說這,問題就在這裏:

2013-03-06 17:38:14.764 LiveiPad[506:607] -[NSIndexPath setTableViewStyle:]: unrecognized selector sent to instance 0x57ac40 

你應該叫setTableViewStyle:一個UITableView對象上,而不是在一個NSIndexPath之一。

從開發文檔:

表視圖可以有兩種樣式之一,UITableViewStylePlain和 UITableViewStyleGrouped。當你創建一個UITableView實例時,你必須指定一個表格樣式,並且這個樣式不能被改變。

所以這個問題最有可能是當你創建UITableView

4

有在的UITableView類這樣的沒有方法稱爲

- (id)initWithFrame:(CGRect)frame 

你需要指定的風格爲好,無論是平原或分組,

正確的方法是- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style;

UITableView *tableView= [[UITableView alloc]initWithFrame:frameTable style:UITableViewStylePlain];或分組

+0

使用了上述行,但仍然崩潰 – iWatch 2013-03-06 14:15:33

1

我使用表格視圖製作自定義單元格時發生同樣的錯誤

錯誤是我沒有回到小區中的cellForRowAtIndexPath:

嘗試返回它的錯誤將得到解決。

相關問題