UIResponder(静态)_setFirstResponder:休息

时间:2013-11-19 02:17:41

标签: ios objective-c

我对这个休息不知道, 你能为我提供一些线索,我们将不胜感激。

  • 线程#1:tid = 0x29927,0x37c47b66 libobjc.A.dylib`objc_msgSend + 6,queue ='com.apple.main-thread,stop reason = EXC_BAD_ACCESS(code = 1,address = 0x8000000c)

帧#0:0x37c47b66 libobjc.A.dylib`objc_msgSend + 6

frame #1: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #2: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #3: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #4: 0x30118732 UIKit`-[UIResponder resignFirstResponder] + 250
frame #5: 0x3027bb68 UIKit`-[UIWebDocumentView resignFirstResponder] + 232
frame #6: 0x3027ba7c UIKit`-[UIWebBrowserView resignFirstResponder] + 124
frame #7: 0x30072504 UIKit`-[UIView(Hierarchy) _willMoveToWindow:] + 660
frame #8: 0x30072d74 UIKit`__85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 76
frame #9: 0x30072ca2 UIKit`-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 378
frame #10: 0x30072d94 UIKit`__85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 108
frame #11: 0x30072ca2 UIKit`-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 378
frame #12: 0x3007fb9a UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 418
frame #13: 0x3014490c UIKit`-[UITableViewCell _addSubview:positioned:relativeTo:] + 88
frame #14: 0x3007f9f2 UIKit`-[UIView(Hierarchy) addSubview:] + 30
frame #15: 0x00068b2e 4399Games1.0`-[SJGameDetailController tableView:cellForRowAtIndexPath:](self=0x162c8e00, _cmd=0x3065c3d7, tableView=0x163b0c00, indexPath=0x19172ab0) + 6478 at SJGameDetailController.m:1515
frame #16: 0x301a6314 UIKit`-[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 408
frame #17: 0x3014e6cc UIKit`-[UITableView _updateVisibleCellsNow:] + 1800
frame #18: 0x3014def0 UIKit`-[UITableView layoutSubviews] + 184
frame #19: 0x30074352 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 346
frame #20: 0x2fcfa942 QuartzCore`-[CALayer layoutSublayers] + 142
frame #21: 0x2fcf6166 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 350
frame #22: 0x2fcf5ff8 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
frame #23: 0x2fcf5a0c QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 228
frame #24: 0x2fcf581e QuartzCore`CA::Transaction::commit() + 314
frame #25: 0x2fcef54c QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
frame #26: 0x2d8baf68 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
frame #27: 0x2d8b88f6 CoreFoundation`__CFRunLoopDoObservers + 286
frame #28: 0x2d8b8c42 CoreFoundation`__CFRunLoopRun + 738
frame #29: 0x2d823470 CoreFoundation`CFRunLoopRunSpecific + 524
frame #30: 0x2d823252 CoreFoundation`CFRunLoopRunInMode + 106
frame #31: 0x3255d2ea GraphicsServices`GSEventRunModal + 138
frame #32: 0x300d8844 UIKit`UIApplicationMain + 1136
frame #33: 0x000498c8 4399Games1.0`main(argc=1, argv=0x27dbecfc) + 116 at main.m:16

2 个答案:

答案 0 :(得分:2)

Rayfleck走上正轨。

如果您想要在视图中的某个位置关闭键盘,请使用以下&让iOS处理响应者链

[self.view endEditing:YES];

当视图中有表格并且表格到处都有文本字段时,这非常有用。

来自Apple Doc:

- (BOOL)endEditing:(BOOL)force

描述 导致视图(或其中一个嵌入的文本字段)重新签署第一个响应者状态。 此方法查看当前第一个响应者的文本字段的当前视图及其子视图层次结构。如果找到一个,则要求该文本字段作为第一响应者辞职。如果force参数设置为YES,则永远不会询问文本字段;它被迫辞职。 参数

指定YES以强制第一响应者辞职,无论是否要这样做。 返回 如果视图重新调整了第一响应者状态,则为YES;如果视图没有,则为NO。

答案 1 :(得分:1)

我遇到了与UITextField完全相同的问题。当我更换

[myTextField resignFirstResponder];

[myTextField endEditing:YES];

撞车停了。