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

//设置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中的层次)