0
我用故事板拖動了一個按鈕,並在.h文件中爲它創建了IBoutlet。更改按鈕文本不起作用iOS
現在我試圖改變按鈕的文本,但它不適合我。
- (id)initWithCoder:(NSCoder *)decoder
{
if ((self = [super initWithCoder:decoder]))
{
configDetails *updatedConfig=[[configDetails alloc]init];
[updatedConfig setAllItemstext:@" Go to AllItems"];
[updatedConfig setAboutUstext:@"Text for AboutUs button"];
[updatedConfig setHomeScreenTitleColor:@"Yellow"];
NSString *newtext=[updatedConfig aboutUstext];
NSLog(@"%@",newtext);
[aboutUs setTitle:[updatedConfig aboutUstext] forState:UIControlStateNormal];
[allItems setTitle:[updatedConfig allItemstext] forState:UIControlStateNormal];
}
return self;
}
上面的代碼是否正在執行?你有沒有嘗試添加一個斷點? – ColinE
'[updatedConfig allItemstext]'獲得了價值嗎? –
@AnoopVaidya雅它輸出giventext – iCoder