设置 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界面显示软件的可更新数等
相关文章
相关标签/搜索