【发布时间】:2011-08-19 03:50:12
【问题描述】:
当我像这样向我的单元格添加一个按钮时,它工作正常,但是当我在 IB 中添加它时,我遇到了上面的日志崩溃。任何想法 ?感谢四位您的回答
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(goToGeoloc)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(218.0, 8.0, 45.0, 45.0);
[cell addSubview:button];
`崩溃日志:
warning: Attempting to create USE_BLOCK_IN_FRAME variable with block that isn't in the frame.
warning: Attempting to create USE_BLOCK_IN_FRAME variable with block that isn't in the frame.
(gdb) bt
#0 0x02c65a93 in objc_msgSend ()
#1 0x00000001 in ?? ()
#2 0x005596c8 in -[UIControl sendAction:to:forEvent:] ()
#3 0x0055bb4a in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#4 0x0055a6f7 in -[UIControl touchesEnded:withEvent:] ()
#5 0x00747070 in _UIGestureRecognizerUpdateObserver ()
#6 0x02aebd1b in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#7 0x02a80987 in __CFRunLoopDoObservers ()
#8 0x02a49c17 in __CFRunLoopRun ()
#9 0x02a49280 in CFRunLoopRunSpecific ()
#10 0x02a491a1 in CFRunLoopRunInMode ()
#11 0x031f72c8 in GSEventRunModal ()
#12 0x031f738d in GSEventRun ()
#13 0x004ddb58 in UIApplicationMain ()
【问题讨论】:
-
您在创建自定义表格视图单元格吗?
-
是的。我正在创建一个自定义 tableView 单元格
-
这里的单元格是什么?是表格视图单元格吗?
-
然后在自定义表格视图单元格中创建按钮或说明更多关于您的问题。
-
当我以编程方式创建它时,它很好。但是当我通过 IB 创建它时,我崩溃了
标签: iphone