[IOS] 'NSInternalInconsistencyException', reason: 'request for rect at invalid i

错误:
引用

2012-12-13 09:59:03.038 jzny[17354:11303] *** Assertion failure in -[UITableViewRowData rectForRow:inSection:], /SourceCache/UIKit_Sim/UIKit-2372/UITableViewRowData.m:1630
2012-12-13 09:59:03.039 xxxx[17354:11303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for rect at invalid index path (<NSIndexPath 0x719c380> 2 indexes [0, 0])'
*** First throw call stack:
(.........)
libc++abi.dylib: terminate called throwing an exception
(lldb)


如果出现以上错误是说UIPickerView绑定数据时,判断如果没有数据就设置pickView.userInteractionEnabled=NO就OK了~~~
-(NSInteger) pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
    [list count]==0?selectPicker.userInteractionEnabled=NO:nil;
    return [list count];
}

猜你喜欢

转载自iaiai.iteye.com/blog/1746881