在iOS 7之前我使用过
[[UITabBar appearance] setTintColor:[UIColor redColor]];
Run Code Online (Sandbox Code Playgroud)
但是现在它只绘制了所选项目,我已经阅读了一些建议,但我无法完成如何操作,我也使用了它:
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"openbookwp4.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"openbookwp4.png"]];
Run Code Online (Sandbox Code Playgroud)
这把我想要的图标和我想要的颜色放在一起,但只有在我选择该标签后,例如,当我打开应用程序时,标签看起来正常,但在我按下第二个标签并返回第一个标签后,第二个标签现在有我想要的颜色.没有图像很难解释,但我无法发布图像......
我使用此代码阻止ios 7之前的旋转(我也使用xibs,现在是storyboard)
- (BOOL)shouldAutorotate {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationPortrait;
}
Run Code Online (Sandbox Code Playgroud)
现在,我迁移到故事板和ios7它不工作,我的观点仍然在旋转.
更新:我通过将此代码添加到委托来解决这个问题,现在我以前的代码就像魅力一样
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
NSUInteger orientations = UIInterfaceOrientationMaskPortrait;
if (self.fullScreenVideoIsPlaying) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else {
if(self.window.rootViewController){
UIViewController *presentedViewController = [[(UINavigationController *)self.window.rootViewController viewControllers] lastObject];
orientations = [presentedViewController supportedInterfaceOrientations];
}
return orientations;
}
Run Code Online (Sandbox Code Playgroud)