有哪位大神绝景版 武器最好用知道这个电脑配置可以卖多少钱

2337人阅读
iOS(120)
iOS 开发过程中可能会有这样的需求。
为了不影响app内容的显示,将顶部的状态栏(现实信号,时间,电量)隐藏
默认状态栏一直是存在的
适用于修改个别页面的状态栏
我们可以通过设置ViewController的属性来隐藏
在 viewDidLoad 方法中添加如下代码
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
再实现一个方法
- (BOOL)prefersStatusBarHidden
return YES;//隐藏为YES,显示为NO
好了 &我们运行一下看看效果
适用于修改所有状态栏
我们找到项目的 info.plist文件(项目自动创建的,一般默认在Supporting Files 下)
查看一下有没有这两个key
Status bar is initially hidden & (value:YES)
View controller-based status bar appearance & (value:NO)
&如果没有 点击+添加
完成之后 效果如下
运行项目 看看效果 是不是 隐藏的,方法二出来之后所有页面不用设置 默认都是 隐藏状态栏的
好了 大家可以加群继续讨论学习
苹果开发群 : &欢迎加入 &欢迎讨论问题
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:772906次
积分:6286
积分:6286
排名:第3349名
原创:133篇
评论:101条
(1)(19)(3)(1)(7)(2)(9)(23)(25)(14)(19)(1)(1)(1)(1)(4)(3)(1)(1)(2)(4)iOS开发系列之常用自定义控件开发集—自定义状态栏消息提示控件开发
在实际开发中消息提示时很常见的需求,为了个性化和拥有简洁的UI状态栏提示是比较好的方案,好处很多如:不遮挡主UI,新意,下面贴出实现代码。
WHC_StatusBarMessage.h头文件如下:
WHCStatusBarMessage.m
WHCStatusBarMessage
Created by apple on 14-3-28.
Copyright (c) 2014年 apple. All rights reserved.
#import &WHC_StatusBarMessage.h&
#define kPading (5.0)
#define kLogoWidth (15.0)
//图标logo宽度
@interface WHC_StatusBarMessage(){
//消息标签
UIImageView * logoImgV;
//logo图标对象
//logo图标
//屏幕宽度
//屏幕高度
@property(nonatomic,retain)UILabel
@property(nonatomic,retain)UIImageView
@property(nonatomic,retain)NSTimer
//停留时钟
@implementation WHC_StatusBarMessage
WHC_StatusBarMessage
//构建单例
+(WHC_StatusBarMessage *)shareStatusBar{
static dispatch_once_t onceT
dispatch_once(&onceToken, ^{
msb = [[WHC_StatusBarMessage alloc]init];
//初始化UI
CGRect statusFrame = [UIApplication sharedApplication].statusBarF
height = statusFrame.size.
screenWidth = [UIScreen mainScreen].bounds.size.
screenHeight = [UIScreen mainScreen].bounds.size.
self = [super initWithFrame:statusFrame];
self.frame = statusF
self.autoresizingMask = UIViewAutoresizingFlexibleW
self.windowLevel = UIWindowLevelStatusBar + 1.0;
self.backgroundColor = kWHC_StatusBarMessageBack_C
logoImg = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@&29x29& ofType:@&png&]];
logoImgV = [[UIImageView alloc]initWithFrame:CGRectMake(kPading, kPading / 2.0, kLogoWidth, kLogoWidth)];
logoImgV.backgroundColor = [UIColor clearColor];
[self addSubview:logoImgV];
msgLab = [[UILabel alloc]initWithFrame:CGRectMake(logoImgV.frame.origin.x + kPading + logoImgV.frame.size.width, 0.0, screenWidth - (logoImgV.frame.origin.x + kPading + logoImgV.frame.size.width), statusFrame.size.height)];
msgLab.backgroundColor = [UIColor clearColor];
msgLab.font = [UIFont systemFontOfSize:14.0];
msgLab.textColor = [UIColor whiteColor];
[self addSubview:msgLab];
//注册单击事件
UITapGestureRecognizer
* tapStatusBar = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapTopBar:)];
[self addGestureRecognizer:tapStatusBar];
//注册状态栏方向监听事件
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(screenOrientationChange:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
//处理单击状态栏消息
- (void)tapTopBar:(UITapGestureRecognizer *)tapGesture{
if(_whcStatusBardelegate && [_whcStatusBardelegate respondsToSelector:@selector(didTapTouchWHCStatusBarMessageDoSomething)]){
[_whcStatusBardelegate didTapTouchWHCStatusBarMessageDoSomething];
//显示状态栏消息
-(void)showTextMessage:(NSString*)strMessage delayTime:(NSInteger)delay
[self.runTimer invalidate];
self.runTimer =
if(logoImg == nil){
logoImg = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@&29x29& ofType:@&png&]];
if(delay == -1) delay = 3;
logoImgV.image = logoI
msgLab.text = strM
__block CGRect
stateFrame = self.
stateFrame.origin.y = -20.0;
self.frame = stateF
[UIView animateWithDuration:0.2 animations:^{
stateFrame.origin.y = 0.0;
self.frame = stateF
[self makeKeyAndVisible];
self.runTimer = [NSTimer scheduledTimerWithTimeInterval:delay target:self selector:@selector(dismissTimer) userInfo:nil repeats:NO];
-(void)showMessage:(NSString*)strMessage logImage:(UIImage *)logImage delayTime:(NSInteger)delay{
logoImg = logI
[self showTextMessage:strMessage delayTime:delay];
-(void)dismissTimer{
double delayInSeconds = 0.3;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
msb.hidden = YES;
#pragma mark - screenChange
-(void)screenOrientationChange:(NSNotification*)notif
UIInterfaceOrientation
orientation = [[[notif userInfo] objectForKey:UIApplicationStatusBarOrientationUserInfoKey] integerValue];
switch (orientation) {
case UIInterfaceOrientationPortrait:
self.transform = CGAffineTransformI
self.frame = CGRectMake(0.0, 0.0, screenWidth, height);
case UIInterfaceOrientationPortraitUpsideDown:
self.transform = CGAffineTransformMakeRotation(M_PI);
self.center = CGPointMake(screenWidth / 2.0, screenHeight - height / 2.0);
self.bounds = CGRectMake(0.0, 0.0, screenWidth, height);
case UIInterfaceOrientationLandscapeLeft:
self.transform = CGAffineTransformMakeRotation(-M_PI_2);
self.center = CGPointMake(height / 2.0, screenHeight / 2.0);
self.bounds = CGRectMake(0.0, 0.0, screenHeight, height);
case UIInterfaceOrientationLandscapeRight:
self.transform = CGAffineTransformMakeRotation(M_PI_2);
self.center = CGPointMake(screenWidth - height / 2.0, screenHeight / 2.0);
self.bounds = CGRectMake(0.0, 0.0, screenHeight, height);OS X 10.10.5
Xcode 6.4(6E35b)
状态栏(UIStatusBar)指iPhone/iPad/iPod屏幕顶部用于显示网络、时间和电量等的、高度为20点的控件。状态栏的windowLevel为UIWindowLevelStatusBar,而window的windowLevel为UIWindowLevelNormal。所以一般情况下,状态栏位于window之上。
二、UIStatusBar的位置和尺寸
1 NSString *statusBarFrame = NSStringFromCGRect([UIApplication sharedApplication].statusBarFrame);
2 NSLog(@"%@", statusBarFrame);
在iPhone 6竖屏测试输出:
16:33:47.159 Test[] {{0, 0}, {375, 20}}
在iPhone 6横屏测试输出:
16:33:47.159 Test[] {{0, 0}, {667, 20}}
在iPhone 6 Plus竖屏测试输出:
16:33:47.159 Test[] {{0, 0}, {414, 20}}
可见其中origin.x和origin.y总是0,size.height总是20,size.width依赖于不同设备及横竖屏。
三、UIStatusBarStyle(字体颜色)和背景颜色
UIStatusBarStyle控制状态栏的字体颜色,在iOS7只支持两种:UIStatusBarStyleDefault、UIStatusBarStyleLightContent。注意,虽然目前表现出来的颜色是黑色或白色,但不是Black或White之类的,苹果留了一手以防以后改变。Default表示深色(Dark),用于亮色(Light)背景;LightContent表示亮色(Light),用于深色(Dark)背景。当然这也不是强制的。
在没有导航栏的情况下,状态栏的背景颜色是透明的,可以在View里添加一个20点高度的子View&伪造&一个背景;在有导航栏的情况下,状态栏的背景颜色和状态栏一样,看起来融为了一体。
四、App启动时状态栏控制
App启动的时候系统加载需要一定的时间,可以给App提供了Launch Image或Launch Screen以增强用户体验。在启动页显示出来的时候App还没有运行,也就谈不上在程序中控制状态栏的字体颜色、显示或隐藏。
默认情况下状态栏是显示出来的,并且Style为UIStatusBarStyleDefault,即黑色。
可以在Info中将Status bar is initially hidden(UIStatusBarHidden)对应的Value设置为Yes。
也可以在General中将Hide status bar勾选:
实际上,上面两种设置方法最终作用到info.plist文件。可以直接修改该文件,如果不嫌麻烦又不担心出错的话。如果没有使用基于ViewController的状态栏控制,并且App内部又需要将状态栏显示出来,可以在AppDelegate中设置:[[UIApplication&sharedApplication]&setStatusBarHidden:NO];
2、设置字体颜色为白色
可以在Info中将Status bar style(UIStatusBarStyle)对应的Value设置为UIStatusBarStyeLightContent。
也可以在General中将Status Bar style选择为Light:
同样的,上面两种设置方法最终作用到info.plist文件。如果没有使用基于ViewController的状态栏控制,并且App内部又需要将状态栏颜色改为黑色,可以在AppDelegate中设置:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
五、App运行时状态栏控制
新建一个Xcode项目,App默认是基于ViewController的状态栏控制,即在ViewController重载prefersStatusBarHidden、preferredStatusBarStyle和preferredStatusBarUpdateAnimation三个方法,及在必要时调用setNeedsStatusBarAppearanceUpdate方法。
如果要使用iOS7之前的通过UIApplication控制状态栏,需在target的info.plist中增加一条View&controller-based&status&bar&appearance(UIViewControllerBasedStatusBarAppearance)并设置为NO。
1、View&controller-based&status&bar&appearance : YES 或 info.plist无此条目
UIViewController方法
- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO
询问是否隐藏状态栏。
- (UIStatusBarStyle)preferredStatusBarStyle NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarStyleDefault
询问状态栏样式(UIStatusBarStyleDefault/UIStatusBarStyleLightContent)。
// Override to return the type of animation that should be used for status bar changes for this view controller. This currently only affects changes to prefersStatusBarHidden.
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarAnimationFade
询问状态栏显示或隐藏动画。
// This should be called whenever the return values for the view controller's status bar attributes have changed. If it is called from within an animation block, the changes will be animated along with the rest of the animation block.
- (void)setNeedsStatusBarAppearanceUpdate NS_AVAILABLE_IOS(7_0);
设置需要更新状态栏。主动调用该方法,将间接调用上述三个方法。如果需要动画生效,需:
&&& [UIView animateWithDuration:0.4&&&&&&&&&&&&&&&&&&&& animations:^{&&&&&&&&&&&&&&&&&&&&&&&& [self setNeedsStatusBarAppearanceUpdate];
&&&&&&&&&&&&&&&&&&&& }];
2、View&controller-based&status&bar&appearance : NO&
UIApplication方法/属性
// Setting statusBarHidden does nothing if your application is using the default UIViewController-based status bar system.
@property(nonatomic,getter=isStatusBarHidden) BOOL statusBarH
- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation NS_AVAILABLE_IOS(3_2);
设置是否隐藏状态栏。
// Setting statusBarHidden does nothing if your application is using the default UIViewController-based status bar system.
@property(nonatomic) UIStatusBarStyle statusBarS // default is UIStatusBarStyleDefault
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)
设置状态栏样式(UIStatusBarStyleDefault/UIStatusBarStyleLightContent)。
如果要在App启动时和运行时全程隐藏状态栏,在View&controller-based&status&bar&appearance为NO的情况下,只需简单将Status bar is initially hidden(UIStatusBarHidden)设置为YES。
六、示例代码
可以根据是否是基于ViewController的状态栏控制来决定是否调用UIApplication中控制状态栏的相关方法,也可以直接调用。因为在基于ViewController的状态栏控制时,调用UIApplication中控制状态栏的相关设置方法会被忽略。
@interface ViewController ()
@property (nonatomic) BOOL statusBarIsH
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.statusBarIsHidden = NO;
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
- (void)viewDidAppear:(BOOL)animated
[super viewDidAppear:animated];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleD
[self performSelector:@selector(setStatusBarHidden:) withObject:@(YES) afterDelay:3.];
[self performSelector:@selector(setStatusBarHidden:) withObject:@(NO) afterDelay:6.];
- (void)setStatusBarHidden:(BOOL)hidden
self.statusBarIsHidden =
[UIView animateWithDuration:0.4
animations:^{
[self setNeedsStatusBarAppearanceUpdate];
[[UIApplication sharedApplication] setStatusBarHidden:hidden withAnimation:UIStatusBarAnimationSlide];
- (UIStatusBarStyle)preferredStatusBarStyle
return UIStatusBarStyleD
- (BOOL)prefersStatusBarHidden
return self.statusBarIsH
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation
return UIStatusBarAnimationS
七、自定义状态栏
见参考资料:
阅读(...) 评论()&&&&自定义的状态栏覆盖在系统状态栏上,能够在自定义的状态栏中显示文字信息,可以隐藏自定义的状态栏,显示系统状态栏。
&&&&作者@贺坤Smaile 说:之前逛街看到移动做推广,有一个定位应用挺好的,合理的利用了状态栏,做了一些消息提醒和隐藏动画,自己回家就做了一个这样的demo,效果很不错,一个多月之前写的,看到有人求,分享出来。
&&&&小编注:demo交互挺不错的。感谢@贺坤Smaile 上传代码于本站。
测试环境:
&&[Code4App]编译测试
相关代码:
(11498次查看,1708次下载) 在状态栏(status bar)上显示自定义的文字,从而覆盖默认的系统信息。覆盖上的文字视图可以自动消失,也可以手动使其消失。
(15016次查看,2246次下载) 实现类似iOS6.0那样的消息通知视图,即消息通知视图(Notification View)以翻滚的形式弹出,并且遮盖住状态栏(UIStatusBar)。弹出的通知视图自动消失。通知视图支持加入多行文字、图片。支持多个通知视图以队列的方式逐个显示。支持ARC。
(11907次查看,1574次下载) 在状态栏(status bar)上显示自定义的文字。状态栏内容切换的动画是,之前的状态栏上的设备状态往上移动,新的自定义的文字内容从下往上进入状态栏。可以设置自动隐藏或者手动隐藏自定义的文字内容。
(13124次查看,2329次下载) 实现各种status bar的覆盖(overlay)效果,包括:在status bar上加入进度条,status bar上的文字变换等等效果。只支持ARC编码模式。
(15490次查看,2448次下载) 在iphone的StatusBar上显示自定义的数据,可以自定义显示数据、背景图片、运行时间、单条运行时间、间隔时间。使用时只需要把AMN_StatusViewControl加入你的工程里,在显示页面引用并设置参数即可。
(13037次查看,1912次下载) 在窗口状态栏(UIStatusBar)顶端或者下端弹出自定义的提示视图(notification View)。例如,图中上方的黑色标签“This is the notification.。可用于显示当前app的状态,用户操作的提示等等。
(15686次查看,1870次下载) 自定义状态栏(Status Bar),支持两种点击动作:
代码评论:
登录后方可评论
如果我横屏,这个不会旋转,怎么办啊
登录后方可评论
-控件分类-
-功能分类-热门搜索:
当前位置:
iOS9越狱美化插件Protean 支持自定义状态栏图标位置
日 16:56&&&&&来源:25pp&&&&&编辑:yxbao&&&&&
iOS9越狱美化插件Protean 可以支持自定义状态栏图标位置吗?Protean是一款功能强大的状态栏增强插件,它的主要功能有:自定义状态栏图标的位置、将状态栏图标隐藏、显示App推送图标、状态栏提供手势功能以及对Flipswitches的支持,下面小编给大家介绍iOS9越狱美化插件Protean 支持自定义状态栏图标位置。
最经典网页版,多人团战跨服玩法冰火战场,十年最经典游戏,英雄合击,3D特效绚丽,赶紧注册试玩一下,
目前,该插件仅兼容iOS9及以下越狱系统,暂不支持iOS9.1及以上系统。有兴趣的小伙伴可以BigBoss源中下载到该插件(售价:1.99美元)。
以上就是游戏堡小编为大家介绍的iOS9越狱美化插件Protean 支持自定义状态栏图标位置,更多精彩内容,请继续关注游戏堡。
延伸阅读:|
最新资讯推荐
扫我,关注游戏侠客
微信号:gamexiake
相关阅读:
阅读(6)04-22
阅读(17)04-18
阅读(17)04-18
阅读(9)04-18
阅读(8)04-18
阅读(9)04-15
阅读(8)04-13
阅读(14)04-07
阅读(9)04-05
阅读(6)04-05
一周热点资讯
小米6发布会直播在哪看,小米6新品发布会直播地址分享 ......
作品版权归作者所有,如果侵犯了您的版权,请联系我们,本站将在3个工作日内删除。
中国综合游戏门户之一,游戏堡网提供(,网络游戏,网页游戏,手机游戏等)资讯,攻略,下载,补丁 是您找游戏内容的最好选择。
All Rights Reserved 湘ICP备号-2 湘公网安备18 苏网文〔-015号
游戏堡网温馨提示:抵制不良游戏,拒绝盗版游戏,注意自我保护,谨防受骗上当,适度游戏益脑,沉迷游戏伤身,合理安排时间,享受健康生活!}

我要回帖

更多关于 大神绝景版 武器最好用 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信