設置 Tab Bar Item屬性

視圖控制器至少須要設置標題和圖片,能夠在Interface Builder中設置Tab Bar Item,也能夠在試圖控制器類中覆蓋initWithNibName:bundle:方法,示例以下。ui

-(id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
{
    self = [super initWithNibName:nibName bundle:nibBundle];
    if (self)
    {
        self.title = @"Title";
        self.tabBarItem.image = [UIImage imageNamed:@"image.png"];
    }
    return self;
}
經過設置試圖控制器的tabBarItem屬性可更改Tab Bar Item的外觀。除了title和image,還有badgeValue屬性用來設置右上角的文字,好比,在App Store界面顯示軟件的可更新數等
相關文章
相關標籤/搜索