IOS博客项目搭建-06-自定义TabBarButton-03

1、按钮方法spa



2、按钮的图片、文字位置处理code

  对按钮属性进行修改:
图片

  // 底部图片居中
  self.imageView.contentMode = UIViewContentModeCenter;
        
  // 文字居中
  self.titleLabel.textAlignment = NSTextAlignmentCenter;
  
   // 文字大小
   self.titleLabel.font = [UIFont systemFontOfSize:11];

  

经过修改属性后,底部button离咱们的新浪微博也愈来愈靠近了。it


3、tabBarItem属性微博

每一个控制器都有一个tabBarItem属性,如首页的tabBarItem属性class

home.tabBarItem.title:标题,home.tabBarItem.image:图片,home.tabBarItem.badgeValue:图片右上角的消息提示数。新浪微博

相关文章
相关标签/搜索