一般用系统的TarBar要有图片或者文字的话,就会显示成图片在左边,文字在右边的情况,如何改变图片在上,文字在下呢
- 作者: 嗫?暁雲?
- 来源: 51数据库
- 2022-08-17
// 内部图片的frame
- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
CGFloat imageW = contentRect.size.width;
CGFloat imageH = contentRect.size.height * IWTabBarButtonImageRatio;
return CGRectMake(0, 0, imageW, imageH);
}
// 内部文字的frame
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
CGFloat titleY = contentRect.size.height * IWTabBarButtonImageRatio;
CGFloat titleW = contentRect.size.width;
CGFloat titleH = contentRect.size.height - titleY;
return CGRectMake(0, titleY, titleW, titleH);
}
推荐阅读
