9:58 AM

UITableView -iphone

Posted by pradeep T

this is an article about table view!!

MAKING table view GROUPED ::

tb = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStyleGrouped];

************

UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,320,440) style:UITableViewStyleGrouped];
tableView.rowHeight = 55;
[tableView setSectionHeaderHeight:5];
[tableView setSectionFooterHeight:5];

2. Setting with Delegate methods.
_______________________________________________________
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 25.0f;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 25.0f;
}
Setting with properties
___________________________________________________________
UITableView *theTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 440) style:UITableViewStyleGrouped];
theTableView.delegate = self;
theTableView.dataSource = self;
theTableView.backgroundColor=[UIColor brownColor];
UIImageView *img=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"flag_green(2).png"]];
img.frame=CGRectMake(5, 10, 5, 5);
[theTableView setTableHeaderView:img]

2. Setting with Delegate methods.
_______________________________________________________
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section // custom view for header. will be adjusted to default or specified header height
{
UIImageView *img=[[UIImageView alloc]initWithImage:myimageview];
img.frame=CGRectMake(5, 10, 10, 10);
return img;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section // custom view for footer. will be adjusted to default or specified footer height
{
UIImageView *img=[[UIImageView alloc]initWithImage:myimageview];
img.frame=CGRectMake(5, 10, 10, 10);
return img;
}

0 comments: