2011-05-05 177 views
0

當我像這樣向我的單元格添加按鈕時,它工作正常,但是當我在IB中添加它時,我遇到了上面的日誌崩潰。任何想法 ?感謝Four的答案應用程序崩潰與按鈕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() 
+0

你創建自定義的tableview細胞? – 2011-05-05 08:00:26

+0

是的,我正在創建一個自定義表格單元格 – izan 2011-05-05 08:02:22

+0

這裏的單元格是什麼?它是一個桌面單元格嗎? – Gypsa 2011-05-05 08:02:43

回答

1
[cell.contentView addSubview:button]; 
相關問題