|
|
|
iOS - How to create separate UIButton for UITableView header title section in iPhone |
|
|
|
|
|
|
|
You have screenshot ?
|
|
|
|
|
Date :
2014-12-10 09:57:43 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thanks mr.win. I done that task
Code (Objective-C)
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
if (section == 0) {
return @"Events you created";
}
else{
return @"Events you participated in";
}
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];
containerView.backgroundColor = [UIColor groupTableViewBackgroundColor];
CGRect labelFrame = CGRectMake(20, 2, 320, 30);
if(section == 0) {
labelFrame.origin.y = 13;
}
UILabel *label = [[UILabel alloc] initWithFrame:labelFrame];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:17];
label.shadowColor = [UIColor colorWithWhite:1.0 alpha:1];
label.shadowOffset = CGSizeMake(0, 1);
label.textColor = [UIColor colorWithRed:0.265 green:0.294 blue:0.367 alpha:1.000];
label.text = [self tableView:tableView titleForHeaderInSection:section];
[containerView addSubview:label];
if(section == 0) {
if (displayObject.count > 0) {
Homebtn = [[UIButton alloc]init];
if (!ShowingListHome) {
[Homebtn setImage:[UIImage imageNamed:@"arrow_down"] forState:UIControlStateNormal];
}else{
[Homebtn setImage:[UIImage imageNamed:@"arrow_up"] forState:UIControlStateNormal];
}
Homebtn.frame = CGRectMake(270,0 , 40, 40);
[Homebtn addTarget: self action: @selector(showNewInv:)
forControlEvents: UIControlEventTouchUpInside];
[containerView addSubview:Homebtn];
}
}
if(section == 1) {
if (displayObject1.count > 0) {
InvBtn =[[UIButton alloc]init];
if (!ShowingListAccept) {
[InvBtn setImage:[UIImage imageNamed:@"arrow_down"] forState:UIControlStateNormal];
}else{
[InvBtn setImage:[UIImage imageNamed:@"arrow_up"] forState:UIControlStateNormal];
}
InvBtn.frame = CGRectMake(270,0 , 40, 40);
[InvBtn addTarget: self action: @selector(showAcceptInv:)
forControlEvents: UIControlEventTouchUpInside];
[containerView addSubview:InvBtn];
}
}
return containerView;
}
|
|
|
|
|
Date :
2014-12-15 16:32:58 |
By :
vishwa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Goodjob!
|
|
|
|
|
Date :
2014-12-15 17:41:46 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|