• iOS push过去的时候界面不能完全退出


    iOS push过去的时候界面不能完全退出

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

    1. initWithFrame方法是什么?

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

    2. 什么时候用initWithFrame方法?

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

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

    比如:

    - (id) initWithFrame: (CGRect)frame{

      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;

    )

  • 相关阅读:
    ASP.NET 后台页面无法识别服务器控件ID
    HTML5 <li> <ol> <ul> 用法
    【转】船体分段测量 船舶精度管理
    【转】2000国家大地控制网
    【转】水准原点
    【转】城市CORS系统建设
    【转】我国常用的高程系统
    【转】地图的分幅与编号
    【转】大地测量系统和参考框架
    【转】国家天文大地网
  • 原文地址:https://www.cnblogs.com/wmx-rj/p/5000298.html
Copyright © 2020-2023  润新知