• 自定义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;

  • 相关阅读:
    Sprinig.net 双向绑定 Bidirectional data binding and data model management 和 UpdatePanel
    Memcached是什么
    Spring.net 网络示例 codeproject
    jquery.modalbox.show 插件
    UVA 639 Don't Get Rooked
    UVA 539 The Settlers of Catan
    UVA 301 Transportation
    UVA 331 Mapping the Swaps
    UVA 216 Getting in Line
    UVA 10344 23 out of 5
  • 原文地址:https://www.cnblogs.com/momosmile/p/5032999.html
Copyright © 2020-2023  润新知