我必须在带有标题标题的tableview标题部分附近显示一个图像。任何人都可以建议最好的方法吗?
提前感谢您的建议。
此致 Sathish所在
答案 0 :(得分:0)
您可以尝试使用带标题和图片的导航栏:
// show image
UIImage *image = [UIImage imageNamed: @"bar_icon.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage: image];
imageView.frame = CGRectMake(70, 0, 40, 40);
//self.navigationItem.titleView = imageView;
// label
UILabel *tmpTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, 0, 200, 40)];
tmpTitleLabel.text = @"Mannschaft";
tmpTitleLabel.backgroundColor = [UIColor clearColor];
tmpTitleLabel.textColor = [UIColor whiteColor];
tmpTitleLabel.font = [UIFont boldSystemFontOfSize:18];
// create new view
CGRect applicationFrame = CGRectMake(0, 0, 300, 40);
UIView * newView = [[[UIView alloc] initWithFrame:applicationFrame] autorelease];
[newView addSubview:imageView];
[newView addSubview:tmpTitleLabel];
self.navigationItem.titleView = newView;
[imageView release];
[tmpTitleLabel release];