0
我是新來的x代碼,我想設置UILabel的x,y位置,但我無法弄清楚它爲什麼不工作。UILabel設置x,y協調不工作
.H
@interface ViewController:UIViewController{
IBOutlet UILabel *badgeslabel;
}
@property (nonatomic,retain)IBOutlet UILabel *badgeslabel;
@end
.M
@implementation ViewController
@synthesize badgeslabel;
-(void)setBadge{
[badgeslabel setAlpha:.5];
[badgeslabel setCenter:CGPointMake(160,30)];
}
的setAlpha工作,但setCenter沒有。另外,當我將代碼放入IBAction時,setCenter可以工作,但我不知道爲什麼。我在xcode 5.0上 任何幫助表示讚賞,謝謝。
自動佈局是否打開?這通常是問題。另外,在.m中,標籤名稱是複數(不同的名稱)。錯字? – Joel
在我的代碼中,標籤的名稱是正確的,我只是在我抄錄到這裏時發生了錯誤,現在已經進行了編輯。關於自動佈局我不知道如何檢查 – Caetano
http://stackoverflow.com/questions/9566789/remove-autolayout-constraints-in-interface-builder – Joel