2014-12-04 35 views
-2

我創建了一個按鈕的UIButton沒有iphone5s工作而工作,而使用即席建立

@property (nonatomic, retain) UIButton *sendBtn; 
@property (nonatomic, retain) UIButton * send; 

//這裏是按鈕

CGRect buttonFrame = CGRectMake(270, 0, 60, 45); 
send = [[UIButton alloc] initWithFrame: buttonFrame]; 
[send setTitle: @"send" forState: UIControlStateNormal]; 
[send addTarget:self action:@selector(sendMsgAction:) forControlEvents:UIControlEventTouchUpInside]; 
[send setTitleColor: [UIColor redColor] forState: UIControlStateNormal]; 
[self addSubview:send]; 
self.otherBtn = send; self.sendBtn = send; 

的代碼時,我用它開發人員配置它的工作原理運行正確 但使用adhoc構建時,它不響應。

注意:它在的iphone4s,ipad2的,iPhone5的通過Adhoc和開發商雙方,但使用即席建設iphone5s工作不細,在使用開發做工精細

+0

檢查這個http://stackoverflow.com/questions/1378765/如何做 - 我創建一個基本的uibutton編程 – Mateusz 2014-12-04 11:09:14

+0

沒有按鈕是正確的,它可能是IOS版本問題的一些體系結構問題,或者可能是開發人員或adhoc構建問題的原因,例如...是否有人面臨這樣的striange行爲?? – iphonemaclover 2014-12-04 11:15:16

+0

注意:向下選民請評論理由來投票! – iphonemaclover 2014-12-04 11:19:22

回答

1

1點:切勿使用備用關鍵字。 SEND應該是sendButton或其他東西。

第2點:正如我看到你有@property (nonatomic, retain) UIButton * send;意味着你連接按鈕與IB。

由於IB中已經有按鈕,因此不要在代碼中再次定義它。所以,我要說,而不是

send = [[UIButton alloc] initWithFrame: buttonFrame]; 

使用它作爲

send.frame = buttonFrame; 

希望這將解決您的問題...

相關問題