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;
}
答案 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;
}