iOS push过去的时候界面不能彻底退出

iOS push过去的时候界面不能彻底退出编程

解决方法:设置self.view.backgroundcolorapp

 

1. initWithFrame方法是什么?ide

  initWithFrame方法用来初始化并返回一个新的视图对象,根据指定的CGRect(尺寸)。字体

2. 何时用initWithFrame方法?spa

  简单的说, 咱们用编程方式申明,建立UIView对象时,使用initWithFrame方法。对象

 

若是在子类中重载initWithFrame方法, 必须先调用父类的initWithFrame方法。在对自定义的UIView子类进行初始化操做。it

好比:io

- (id) initWithFrame: (CGRect)frame{sed

  self = [super initWithFrame:frame];//先调用父类的initWithFrame方法配置

  if(self){

  //再自定义该类(UIView子类)的初始化操做。

        _scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];

        [_scrollView setFrame:CGRectMake(0, 0, 320, 480)];

        _scrollView.contentSize = CGSizeMake(320*3, 480);

        [self addSubView:_scrollView];

  }

  return self;

}

 

- (BOOL)respondsToSelector: selector 用来判断是否有以某个名字命名的方法(被封装在一个selector的对象里传递)

 

关于导航栏,状态栏,返回按钮的颜色

1. 配置全局导航条颜色

[[UINavigationBar appearance]setBarTintColor:ZDColor(52, 57, 69)

/:注:上面的ZDColor为pch文件中声明的:

// 颜色

#define ZDColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

2. 设置全局导航栏中返回箭头和及右边按钮的颜色

[[UINavigationBar appearance]setTintColor:[UIColor whiteColor]];

3. 设置全局导航栏的title字体颜色

    NSShadow *shadow = [[NSShadow alloc] init];

    shadow.shadowColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.8];

    shadow.shadowOffset = CGSizeMake(0, 1);

    [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:246 green:245 blue:245 alpha:1], NSForegroundColorAttributeName, shadow, NSShadowAttributeName, [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:18], NSFontAttributeName, nil]];

注:在声明了上面一步以后,这一步不须要了。

4. 注释掉返回箭头中的字体

在每一个controller中加入方法:

- (void)hideWords{

  [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)

                                                         forBarMetrics:UIBarMetricsDefault];

}

5. 将全局状态栏设置为白色

1>. plist里面, 新建View controller-based status bar appearance, 设为NO。而后在appdelegate里面设置:

    // 2.UIApplication设置状态栏的样式

    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

(这里须要注意一个问题,若是设置了没有效果,在某一个子controller中设置,以下:

    //显示状态栏

    [UIApplication sharedApplication].statusBarHidden=NO;

)

相关文章
相关标签/搜索