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.
- (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.
You need to create a custom UIView. The best way I have found to do this is in 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];
}
In the UITableView
delegate use:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
to return a custom UIView object, where you can change what you need. See link .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.