• 导航栏,黑线,translucent Tab


    隐藏navigationitem中的buttonitem

    self.navigationItem.rightBarButtonItem.customView.hidden = YES;

     

     "Illegal property type, c for appearance setter, _installAppearanceSwizzleF  

    在iOS8下没问题,但到了iOS7一运行就crash。

    之后找到原因,是因为这一行代码:

    [[UINavigationBar appearance] setTranslucent:NO]

    这是一个很奇怪的问题,iOS7不支持这种写法(iOS8是没问题的),不知是苹果有意为之还是bug,似乎iOS7中,[UINavigationBar appearance]是没有translucent属性的。

     

    self.navigationController.navigationBar.translucent = NO;

     

    tab push时隐藏

    self.tabBarController.hidesBottomBarWhenPushed = YES;

     

    隐藏导航栏 [[self navigationController] setNavigationBarHidden:NO animated:NO];

    ios7 uinavigationbar下面的黑线

    IOS 实现自定义的导航栏背景以及自定义颜色的状态栏(支持7.0以及低版本)

    摘录:

    //创建一个高20的假状态栏背景

    UIView *statusBarView = [[UIView alloc] initWithFrame:CGRectMake(0, -20, 320, 20)];

    //将它的颜色设置成你所需要的,这里我选择了黑色,表示我很沉稳

        statusBarView.backgroundColor=[UIColor blackColor];

    //这里我的思路是:之前不理想的状态是状态栏颜色也变成了导航栏的颜色,但根据这种情况,反而帮助我判断出此时的状态栏也是导航栏的一部分,而状态栏文字浮于上方,因此理论上直接在导航栏上添加一个subview就是他们中间的那一层了。

    //推得这样的代码:

        [self.navigationController.navigationBar addSubview:statusBarView];

     

    IOS7的状态栏和导航栏 很好

    search bar位置调整:

    self.navigationItem.titleView = search;

    覆盖自定义view的setframe方法

    - (void)setFrame:(CGRect)frame

    {

        CGRect t = CGRectMake(kNavTitleViewX, frame.origin.y, kScreenW - 2 * kNavTitleViewX, frame.size.height);

        [super setFrame:t];

        NSLog(@"seachBar frame:%@",NSStringFromCGRect(frame));

    }

    参考资料 stackoverflow

     

    iOS隐藏导航栏底部的线条& UINavigationBar小技巧

    隐藏返回按钮后面的文字

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

    设置导航栏底部线条颜色的代码:

    UINavigationBar *navigationBar = self.navigationController.navigationBar; 
    [navigationBar setBackgroundImage:[[UIImage alloc] init] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; //此处使底部线条颜色为红色
    [navigationBar setShadowImage:[UIImage imageWithColor:[UIColor redColor]]];

  • 相关阅读:
    oc结构
    iOS分类
    iOS协议
    缓存无底洞现象
    数据库备份,恢复
    PHP邮件发送库:Swiftmailer
    PHP分页组件:Paginator
    PHP验证码类
    PHP日期和时间处理组件-Carbon
    composer的一些操作
  • 原文地址:https://www.cnblogs.com/dqxu/p/4070457.html
Copyright © 2020-2023  润新知