Navigation bar button item image color is different when design through xib of xcode5

前端 未结 6 579
自闭症患者
自闭症患者 2021-02-03 20:46

I am creating navigation bar button using xib but when i going to set image to bar button then image colour is different as original image.

Here is my orignal image.

6条回答
  •  鱼传尺愫
    2021-02-03 21:46

    You need to set tint color as well - which worked for me - You can generate UIBarButtonItem via code as follows:

    #define setTurqoiseColor [UIColor colorWithRed:68.0f/255.0f green:181.0f/255.0f blue:223.0f/255.0f alpha:1.0]
    
    UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithImage:buttonImage style:UIBarButtonItemStyleBordered target:self action:@selector(toggleMenu)];
    menuButton.tintColor = setTurqoiseColor;
    

提交回复
热议问题