0
當用戶在UITableView
的文本區域單元格中輸入不正確的輸入時,我想將頁腳更改爲帶有彩色文本的警告,以描述錯誤。除了着色之外,我已經完成了它的工作。 我的代碼如下我做錯了什麼,這樣的文字沒有着色?爲什麼我無法更改桌面頁腳的文字顏色?
- (UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
switch (section)
{
// Inspection confirms this case is entered when needed.
case SECTION_VALIDATABLE_FORM:
{
UITableViewHeaderFooterView *warningFooter = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:K_FOOTER_WARNING];
UIColor *color = [MyColors uiColorForKey:K_COLOR_TEXT_ERROR]; // inspection confirms this is the UIColor equivalent of #BB2222
[warningFooter.textLabel setTextColor:color];
return warningFooter;
}
// other sections...
}
return nil;
}
我可以使用類別來實現嗎? –
不幸的是,你不能添加屬性的類別。 – deadbeef
對不起,我很困惑...你沒有提到'@ property's,我能不能用一個重寫的getter創建一個類別?另外,我必須覆蓋哪些屬性? 'label'? –