美文网首页
iOS 动态调整subview在superview中的层次

iOS 动态调整subview在superview中的层次

作者: Happy晓哥 | 来源:发表于2017-02-17 11:09 被阅读125次

//设置tabbarcontroller的tabbaritem图片的大小
UIImage *tabbarimage=[UIImage imageNamed:@"first.png"];
UIImageView *tabBarBackgroundImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,self.tabBar.frame.size.width, self.tabBar.frame.size.height)];
//tabBarBackgroundImageView.contentMode = UIViewContentModeScaleAspectFit;//效果将按原图原来的比例缩放
tabBarBackgroundImageView.image =tabbarimage;
[self.tabBar insertSubview:tabBarBackgroundImageView atIndex:1]; //atIndex决定你的图片显示在标签栏的哪一层

相关文章

网友评论

      本文标题:iOS 动态调整subview在superview中的层次

      本文链接:https://www.haomeiwen.com/subject/bsvkwttx.html