2010-10-15 53 views
0

我有一個按鈕,當我嘗試寫myButton。那麼如果我單擊esc按鈕沒有選項或任何智能結果。myButton.frame不可用爲什麼?

謝謝

+1

取決於您的代碼,有時自動完成功能無法正常工作。但很可能你的語法錯誤在你的myButton.fr – 2010-10-15 17:02:15

+0

之前請嘗試重新說明這一點,並告訴我們更多關於你期望的事情和類似的事情...因爲它現在,我不明白你在問什麼, 恐怕。 – DarkDust 2010-10-15 17:03:51

+0

謝謝大家是的問題是從以前的寫作 – 2010-10-15 17:08:48

回答

1

你的代碼是這樣嗎?

@interface myViewController : UIViewController { 
    UIBUtton *myButton; 
} 
@property (nonatomic, retain) IBOutlet UIButton *myButton 

@end; 

@implementation myViewController 

@synthesize myButton; 

- (void) someMethod 
{ 
    //Use myButton Here? 
    CGRect r = myButton.frame; 
} 

@end 

或本:

@interface myViewController : UIViewController { 
    // No need to declare myButton for iPhone or Mac 64-bit 
} 
@property (nonatomic, retain) IBOutlet UIButton *myButton 

@end; 

@implementation myViewController 

@synthesize myButton; 

- (void) someMethod 
{ 
    //Use myButton Here? 
    CGRect r = self.myButton.frame; 
} 

@end 

,如果是後者,myButton不是私有變量 - 僅屬性。

+0

我的代碼像第一個塊 – 2010-10-15 17:23:12