2013-09-25 4 views
11

ठीक है, मैं IOS 6 से 7 iOS 6 उन्नत करने के लिए के साथ एक समस्या ठीक काम करता है, लेकिन मैं iOS7 में निम्न त्रुटि प्राप्तNSInvalidArgumentException ', कारण:' - [UITableViewWrapperView indexPathForCell:]

मुझे यकीन है कि नहीं कर रहा हूँ है लेकिन मुझे लगता है कि त्रुटि यहां होती है।

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
static NSString *CellIdentifier = @"Events Cell"; 

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
} 

// Configure the cell... 
Event *event = [self.fetchedResultsController objectAtIndexPath:indexPath]; 
cell.textLabel.text = event.name; 
return cell; 
} 

असल में जब मैं एक TableViewCell कहते हैं, यह एक Datepicker लाता है लेकिन जब मैं "पूर्ण" बटन हिट यह दुर्घटनाओं। कोई सुराग?

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewWrapperView indexPathForCell:]: unrecognized selector sent to instance 0xc133070' 



2013-09-24 17:26:14.056 CRM4Life[36587:a0b] -[UITableViewWrapperView indexPathForCell:]:  unrecognized selector sent to instance 0xc133070 
2013-09-24 17:26:14.097 CRM4Life[36587:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewWrapperView  indexPathForCell:]: unrecognized selector sent to instance 0xc133070' 
*** First throw call stack: 
(
0 CoreFoundation      0x02d425e4 __exceptionPreprocess + 180 
1 libobjc.A.dylib      0x019818b6 objc_exception_throw + 44 
2 CoreFoundation      0x02ddf903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 
3 CoreFoundation      0x02d3290b ___forwarding___ + 1019 
4 CoreFoundation      0x02d324ee _CF_forwarding_prep_0 + 14 
5 CRM4Life       0x0000dd0e -[CoreDataTableViewCell resignFirstResponder] + 206 
6 UIKit        0x00640550 -[UIResponder becomeFirstResponder] + 347 
7 UIKit        0x00543d0b -[UIView(Hierarchy) becomeFirstResponder] + 114 
8 UIKit        0x00bc30e3 -[UITextField becomeFirstResponder] + 51 
9 UIKit        0x00868651 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary] + 135 
10 UIKit        0x0086aba2 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:] + 2640 
11 UIKit        0x0085ef8c _UIGestureRecognizerSendActions + 230 
12 UIKit        0x0085dc00 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383 
13 UIKit        0x0085f66d -[UIGestureRecognizer _delayedUpdateGesture] + 60 
14 UIKit        0x00862bcd ___UIGestureRecognizerUpdate_block_invoke + 57 
15 UIKit        0x00862b4e _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317 
16 UIKit        0x00859248 _UIGestureRecognizerUpdate + 199 
17 UIKit        0x00525d4a -[UIWindow _sendGesturesForEvent:] + 1291 
18 UIKit        0x00526c6a -[UIWindow sendEvent:] + 1030 
19 UIKit        0x004faa36 -[UIApplication sendEvent:] + 242 
20 UIKit        0x004e4d9f _UIApplicationHandleEventQueue + 11421 
21 CoreFoundation      0x02ccb8af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 
22 CoreFoundation      0x02ccb23b __CFRunLoopDoSources0 + 235 
23 CoreFoundation      0x02ce830e __CFRunLoopRun + 910 
24 CoreFoundation      0x02ce7b33 CFRunLoopRunSpecific + 467 
25 CoreFoundation      0x02ce794b CFRunLoopRunInMode + 123 
26 GraphicsServices     0x02f9c9d7 GSEventRunModal + 192 
27 GraphicsServices     0x02f9c7fe GSEventRun + 104 
28 UIKit        0x004e794b UIApplicationMain + 1225 
29 CRM4Life       0x0000216d main + 141 
30 CRM4Life       0x000020d5 start + 53 
31 ???         0x00000001 0x0 + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

उत्तर

28
//for iOS 6 or earlier 

UITableView* tableView = (UITableView *)cell.superview; 

// for iOS 7 UITableViewWrapperView has been added as superview 

if (IOS_7) { 
    tableView = (UITableView *)cell.superview.superview; 
} 

iOS7

UITableViewCellScrollView में सेल &

UITableViewWrapperView की subviews सेल के superviews के रूप में शुरू किया गया है के रूप में पेश किया गया है। (बस 1 स्तर अतिरिक्त)

तो तुम UITableViewWrapperView से बाहर UITableView उदाहरण प्राप्त करना चाहते हैं, तो आप UITableViewWrapperView उदाहरण पर superview का उपयोग करना होगा।

+0

क्षमा करें, अभी भी स्पष्ट नहीं है। मैं अभी भी कोडिंग में नया हूँ। – Scubadivingfool

+0

@ स्कुबाडिविंगफूल मुझे बताएं कि आपका क्या संदेह है? –

+0

मुझे यकीन नहीं है कि दूसरे पर्यवेक्षण के लिए क्या जोड़ना है। – Scubadivingfool

संबंधित मुद्दे