iOS: Navigation bar with images for buttons

后端 未结 4 1813
天命终不由人
天命终不由人 2021-01-02 07:43

I would like to create a NavigationBar with images as buttons on the right side of the NavigationBar.

Something like below Snapshot

4条回答
  •  攒了一身酷
    2021-01-02 08:04

    UIView *viewWithButtons = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
    //view customization
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    //Button customiztaion
    [viewWithButtons addSubview:leftButton];
    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    //Button customiztaion
    [viewWithButtons addSubview:rightButton];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:viewWithButtons];
    [viewWithButtons release];
    

提交回复
热议问题