作为第一个Tab,需要设置Title,在init内搞定:

- (id)init {
    self = [super init];
    if (self) {
        [self setTitle:@"图片展示"];
        UIImage *img = [UIImage imageNamed:@""];
        [[self tabBarItem] setImage:img];
    }
    return self;

此处未添加图片名称,所以TabBar只显示“图片展示”。

在- (void)viewDidLoad 中添加view add image 代码:

UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(50.050.048.048.0)];
imageview.image = [UIImage imageNamed:@"China.gif"];
[self.view addSubview:imageview];
[imageview release];

 使用UIImageView添加图片,然后再add至self.view。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案