将图像放在桌面iphone上
|
我有以编程方式配置的三行。我只想将图像放在表格视图的第一行上。图片必须覆盖整个第一行(默认情况下不在表格视图单元格的左侧)
这是我的代码:
- (CGFloat)tableView:(UITableView *)aTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.row)
{
case 1:
if(indexPath.row==1)
{
return 230.0; // first row is 123px high
}
default:
return 100.0; // all other rows are 40px high
}
}
-(void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.row) {
case 0:
break;
case 1:
if (indexPath.row==1) {
UIButton *button1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button1 setFrame:CGRectMake(5, 10, 310, 40)];
[button1 setTitle:@\"Give\" forState:UIControlStateNormal];
[button1 addTarget:self action:@selector(give)
forControlEvents:UIControlEventTouchUpInside];
[button1.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];
[button1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[cell.contentView addSubview:button1];
UIButton *button2=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button2 setFrame:CGRectMake(5, 60, 310, 40)];
[button2 setTitle:@\"YouTube\" forState:UIControlStateNormal];
[button2 addTarget:self action:@selector(Announcements)
forControlEvents:UIControlEventTouchUpInside];
[button2.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];
[button2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[cell.contentView addSubview:button2];
UIButton *button3=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button3 setFrame:CGRectMake(5, 110, 310, 40)];
[button3 setTitle:@\"Follow us on Twitter\" forState:UIControlStateNormal];
[button3 addTarget:self action:@selector(Twitter)
forControlEvents:UIControlEventTouchUpInside];
[button3.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];
[button3 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[cell.contentView addSubview:button3];
UIButton *button4=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button4 setFrame:CGRectMake(5, 160, 310, 40)];
[button4 setTitle:@\"Follow us on FaceBook\" forState:UIControlStateNormal];
[button4 addTarget:self action:@selector(Facebook)
forControlEvents:UIControlEventTouchUpInside];
[button4.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];
[button4 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[cell.contentView addSubview:button4];
/*[button1 release];
[button2 release];
[button3 release];
[button4 release];*/
}
break;
default:
break;
}
}
没有找到相关结果
已邀请:
1 个回复
磨标烫徽啪