UIBarButtonItem Custom view in UINavigationBar

后端 未结 2 1070
野的像风
野的像风 2020-12-05 18:30

I am making a custom bar buttons for uinavigationbar, I am using following code

 UIImageView *backImgView= [[UIImageView alloc] initWithImage:[UIImage imageN         


        
2条回答
  •  借酒劲吻你
    2020-12-05 19:24

    I accomplished this using following code:

    UIButton *nxtBtn =  [UIButton buttonWithType:UIButtonTypeCustom];
    [nxtBtn setImage:[UIImage imageNamed:@"chk_next.png"] forState:UIControlStateNormal];
    [nxtBtn addTarget:self action:@selector(NextBtn) forControlEvents:UIControlEventTouchUpInside];
    [nxtBtn setFrame:CGRectMake(0, 0, 64, 31)];
    UIBarButtonItem *nextButton = [[UIBarButtonItem alloc] initWithCustomView:nxtBtn];
    
    checkIn_NavBar.topItem.rightBarButtonItem=nextButton;
    

提交回复
热议问题