图标未显示在UITab栏中

时间:2012-11-05 02:08:37

标签: iphone ios uitabbar

UITab栏中没有显示图标,而是显示了一些矩形。可能是什么问题?

我的代码:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
   self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  if (self) {
    self.tabBarItem.image = [UIImage imageNamed:@"poolmate.png"];
}
return self;
}

1 个答案:

答案 0 :(得分:0)

您从未初始化tabBarItem。试试这个:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.tabBarItem = [self tabBarItem];
        self.tabBarItem.image = [UIImage imageNamed:@"poolmate.png"];
    }
    return self;
}