Pressing the button pushes a view onto the navigation controller that shows a webpage off our server with the help contents.
I got the graphic for the help button by changing the hue/saturation from an icon purchased from icons-icons.com.
Sorry for bad formatting from the blog stuff.
In the .h file...
#define SETTING_HEADER_FONT_SIZE 16.0
#define SETTING_HEADER_HEIGHT 36.0
#define SETTING_HEADER_ROW_WIDTH 308.0
In the .m file...
In the viewDidLoad, there's this to set the heights.
tableView.sectionHeaderHeight = SETTING_HEADER_HEIGHT;
tableView.sectionFooterHeight = 6;
- (UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section {
UIView *hdrView = [[UIView alloc]
initWithFrame:CGRectMake(0,6, SETTING_HEADER_ROW_WIDTH, SETTING_HEADER_HEIGHT)];
hdrView.backgroundColor = [UIColor clearColor];
UILabel *label;
label = [[UILabel alloc] initWithFrame:CGRectMake(12, 6, SETTING_HEADER_ROW_WIDTH-100, SETTING_HEADER_HEIGHT)];
label.font = [UIFont boldSystemFontOfSize:SETTING_HEADER_FONT_SIZE];
label.textAlignment = UITextAlignmentLeft;
label.highlightedTextColor = [UIColor whiteColor];
label.textColor = [UIColor darkGrayColor];
label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0, 1);
label.backgroundColor = [UIColor clearColor];
if (section==0) {
label.text = @"Downloading Files";
} else if (section==1) {
label.text = @"Sharing \"Saved Files\"";
}
[hdrView addSubview:label];
UIButton *button = nil;
if (section==1) {
button = [[UIButton alloc] initWithFrame:CGRectMake(SETTING_HEADER_ROW_WIDTH-32, 2, 32, 32)];
[button addTarget:self action:@selector(clickSharingHelp: forControlEvents:UIControlEventTouchUpInside];
}
if (button!=nil) {
[button setImage:[UIImage imageNamed:@"help32.png"] forState:UIControlStateNormal];
button.showsTouchWhenHighlighted = YES;
[hdrView addSubview:button];
}
return hdrView;
}
2 comments:
Im assuming this needs to be in grouped style for the sections to not stay static while the table moves up and down? If it can be a plain styled table, then any idea why my sections stay put as the table moves?
Yes, for grouped style. Haven't tried with ungrouped...
Post a Comment