[英]How can i change the font color for titleForHeaderInSection?
This is what i currently have to display my text, but i can't seem to be able to change the font color of titleForHeaderInSection. 这是我当前必须显示的文本,但是我似乎无法更改titleForHeaderInSection的字体颜色。
- (NSString *)tableView:(UITableView *)tableView
titleForHeaderInSection:(NSInteger)section
{
if(section == 0)
return @"Information";
if(section == 1)
return @"Categorize Information";
return nil;
}
How would i be able to change the font color so it could be red for example? 我将如何更改字体颜色,例如可以是红色?
Edit: I forgot to mention, i'm not using Interface Builder do do this. 编辑:我忘了提,我没有使用Interface Builder来做到这一点。
You need to create a custom UIView. 您需要创建一个自定义UIView。 The best way I have found to do this is in Interface Builder.
我发现最好的方法是在Interface Builder中。
@interface MyViewController : UITableViewController {
IBOutlet UIView *headerView;
}
@property (nonatomic, retain) UIView *headerView;
@end
#import “MyViewController.h”
@implementation MyViewController
@synthesize headerView;
#pragma mark Table Stuff
- (UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section
{
/* create a UIView here */
return headerView;
}
#pragma mark Memory Management
- (void)dealloc {
[headerView release];
[super dealloc];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.