2
我在我的应用程序中为TableView的标题设置图像。带有图像的表格视图标题在iPhone 5中不工作
它在Iphone 3G中正常工作,但相同的代码不在Iphone 5中工作。 它只显示帧只有非常小的图像。
当我增加帧宽度图像不增加。
这里是我的代码:
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
CGSize result = [[UIScreen mainScreen] bounds].size;
NSLog(@"height%f",result.height);
if(result.height > 500){
NSLog(@"iPhone 5");
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320,30)];
UIImageView *img = [[UIImageView alloc]initWithFrame:headerView.frame];
if(tableView == tableview1)
{
img.image = [UIImage imageNamed:@"My Contacts Overlay.fw.png"];
}
else if(tableView == tableview2)
{
img.image = [UIImage imageNamed:@"My Contacts Overlay2.fw.png"];
}
[headerView addSubview:img];
return headerView;
}
}
谁能请!在这帮助我?
你设置'heightForHeaderInSection'回报您的视线的高度? – pmk 2013-03-06 14:47:27
yes.i确实如此... – user2134883 2013-03-06 14:48:35
@ipatel是否编辑我的代码? – user2134883 2013-03-06 15:00:01