自定义导航左按钮

直接上代码:

#pragma mark - 顶部返回按钮

-(void)customizeNavigationLeftButton

{

    UIButton *leftBt = [UIButton buttonWithType:UIButtonTypeCustom];

    leftBt.frame = CGRectMake(0, 0, 8*WIDTH_ADAPTAION_RATE, 15*HEIGHT_ADAPTAION_RATE);

    [leftBt setBackgroundImage: NAVIGATIONBAR_LEFT_RETURNBUTTON_PIC forState:UIControlStateNormal];

    leftBt.backgroundColor = [UIColor clearColor];

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftBt];

    [leftBt addTarget:self action:@selector(returnAction:) forControlEvents:UIControlEventTouchUpInside];

}

 

posted on 2015-11-24 10:56  wyw880101  阅读(197)  评论(0编辑  收藏  举报