我在那里你点击一个UIImageView和按钮淡出回来的应用程序.状态栏不相同,除了它只是涉及到快.有没有办法计算其淡入时间以匹配我的按钮时间?这是我的.m文件,其中包含按钮和状态栏的代码.
.M
- (void)viewDidLoad
{
////Loads UIImageView from URL
todaysWallpaper.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.inkdryercreative.com/daily/archive/mondays/images/062-mondays-960x640-A.jpg"]]];
_buttonsVisible = false;
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)];
[todaysWallpaper addGestureRecognizer:tapGesture];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
- (void)imageTapped:(UIGestureRecognizer *)sender {
float targetA = 0;
if(_buttonsVisible == NO) {
targetA =1.0;
} else {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(imageTapped:) object:nil];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
[[UIApplication sharedApplication] …Run Code Online (Sandbox Code Playgroud) 我想将状态栏文本颜色更改为客户颜色,如附加屏幕截图。
我已经用它来使它的内容变得轻巧 -
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Run Code Online (Sandbox Code Playgroud)
但文字颜色没有改变。任何人都可以帮忙吗?
我正在开发一个 swift 应用程序,我想UIStatusBarStyle根据应用程序的主题进行更改(有 2 个选项 - 浅色和深色主题)。我已View controller-based status bar appearance到NO的info.plist,并在UIViewController我试图根据当前的主题,像这样进行设置:
override var preferredStatusBarStyle: UIStatusBarStyle {
return Theme.current.statusBarStyle
}
protocol ThemeProtocol {
// Status Bar
var statusBarStyle: UIStatusBarStyle { get }
}
class Theme {
static var current: ThemeProtocol = LightTheme()
}
class LightTheme: ThemeProtocol {
// Status Bar
var statusBarStyle: UIStatusBarStyle = .default
}
class DarkTheme: ThemeProtocol {
// Status Bar
var statusBarStyle: UIStatusBarStyle = .lightContent
}
Run Code Online (Sandbox Code Playgroud)
真的没有结果。我试图通过仅返回来测试它:return …
iPhone App中是否必须使用状态栏?
如果我在我的iPhone应用程序的所有屏幕中隐藏状态栏,Apple会拒绝我的应用程序吗?
谢谢.
我有一个标签栏应用程序,状态栏色调颜色设置为默认值 - 所以它始终是我在我的应用程序中选择的蓝色.
但是,在一个视图中,我隐藏了我的导航栏,如下所示:
[self.navigationController setNavigationBarHidden:YES];
Run Code Online (Sandbox Code Playgroud)
这是在viewWillAppear方法中,视图是可访问的,因为它是我的应用程序的选项卡之一.
我隐藏它的原因是因为我想在其位置放置一个工具栏(大约有6个按钮).
我已设置工具栏的色调颜色,但此视图上的状态栏始终为黑色.有没有办法重新设置此视图的状态栏,或者是否有更好的方法隐藏导航栏以保留状态栏色调颜色.
更新我在某处读到当着色设置为默认值时,状态栏的颜色将是标题中最低像素的颜色.
我曾尝试将导航栏隐藏在故事板中,并尝试将色调颜色更改为"自定义",但这也没有效果.
这两个截图可能会说明我的问题.切换导航栏会更改状态栏颜色.这是有问题的视图嵌入的导航控制器.


对于iOS 7,我有状态栏问题.为此我通过在Appdelegate中使用以下代码解决了它
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
self.window.bounds = CGRectMake(0,0, self.window.frame.size.width, self.window.frame.size.height);
}
Run Code Online (Sandbox Code Playgroud)
一切都很完美.
只有它在拍照时才会出问题.
当我打开相机或照片库时,我仍然会看到状态栏,因此我看到了一半导航标题,如下所示.

知道我怎么能克服这个错误?
问题是:
照片库/相机就像上面的图像
如果单击取消,我的视图会自动向上移动20px.
如果我想隐藏单个视图控制器子类的状态栏,那么我这样做:
override var prefersStatusBarHidden: Bool {
return true
}
Run Code Online (Sandbox Code Playgroud)
但是如果我想在所有视图控制器子类中默认隐藏状态栏怎么办?在项目设置中选中"隐藏状态栏"不会执行任何操作.
我正在尝试编程UIPageViewController包含许多连接到它的视图控制器.不必将它们全部子类化就好了.
当我将状态栏的背景色更改为本机UIColor.gray时,它也会更改。但是,当我要使用自定义颜色时,它会变成黑色。
UIApplication.shared.statusBarView?.backgroundColor = UIColor.gray-此代码正常工作。状态栏背景颜色为灰色
UIApplication.shared.statusBarView?.backgroundColor = UIColor(red: 30/255, green: 30/255, blue: 30/255, alpha: 1)-此代码无法正常工作。状态栏背景颜色为黑色
在XCode 5中,如果我检查状态栏:在项目目标设置中的应用程序启动期间隐藏.
在iOS6和iOS7上工作的任何建议如何在应用程序启动期间隐藏状态栏?
我希望UIStatusBar在我的应用程序中设置背景颜色,我希望它匹配的背景颜色,和应用程序UINavigationBar相同.FacebookInstagram
我尝试将此函数添加到didFinishLaunchingWithOptions我的方法中AppDelegate:
-(void) setStatusBarColour{
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0,self.window.rootViewController.view.frame.size.width, 20)];
view.backgroundColor=[[UIColor lightGrayColor] colorWithAlphaComponent:0.6];
[self.window.rootViewController.view addSubview:view];
}
}
Run Code Online (Sandbox Code Playgroud)
它似乎没有工作.
是否有捷径可寻?