zoukankan      html  css  js  c++  java
  • 自定义navigationbar

     

       UINavigationBar *bar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, kDeviceWidth, 64)];

        [bar setBackgroundImage:[UIImage imageNamed:@"blackbg"] forBarMetrics:UIBarMetricsDefault];

        UINavigationItem *item = [[UINavigationItem alloc] init];

        

        UIButton *backBarButton=[[UIButton alloc] initWithFrame:CGRectMake(0, 7, 30, 30)];

        [backBarButton setBackgroundImage:[UIImage imageNamed:@"nav_back"] forState:UIControlStateNormal];

        backBarButton.showsTouchWhenHighlighted=YES;

        [backBarButton addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];

        

        UIBarButtonItem *backItem=[[UIBarButtonItem alloc] initWithCustomView:backBarButton];

        item.leftBarButtonItem = backItem;

        [bar pushNavigationItem:item animated:NO];

        [self.view addSubview:bar];

        

        UILabel * titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 44)];

        titleLabel.backgroundColor=[UIColor clearColor];

        titleLabel.font=[UIFont systemFontOfSize:18];

        titleLabel.text=@"Etcast";

        titleLabel.textAlignment=NSTextAlignmentCenter;

        titleLabel.textColor=[UIColor whiteColor];

        item.titleView=titleLabel;

  • 相关阅读:
    pandas Series和DataFrame数据类型
    numpy 统计函数与随机数
    numpy 索引
    numpy 数组复制与广播机制
    numpy 合并数组和切割数组
    numpy 添加删除去重及形状变换
    项目导入问题---讨厌的红色感叹号
    SpringMVC框架-----概述(2)
    SpringMVC框架-----概述(1)
    SpringBoot框架----概述(1)
  • 原文地址:https://www.cnblogs.com/momosmile/p/5032999.html
Copyright © 2011-2022 走看看