How to have two different colors for two UIBarButtonItem in navigation bar at the same time?

101 views Asked by At

Are there any standard methods for having two different colors for two UIBarButtonItems on a navigationBar at the same time?

This could be achieve using custom UIButton, e.g.:

UIButton *confirmBtn = [[UIButton alloc] init];
confirmBtn.titleLabel.font =[UIFont boldSystemFontOfSize:16.0f];
[confirmBtn setTitle:@"Confirm" forState:UIControlStateNormal];
confirmBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, -40);
[confirmBtn setTitleColor:[ColorSetter colorWithHexString:@"ffd420"] forState:UIControlStateNormal];
confirmBtn.frame = CGRectMake(0, 0, 80, 50);
[confirmBtn addTarget:self action:@selector(DoneClicked:) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *confirmBtnBarItem = [[UIBarButtonItem alloc] initWithCustomView:confirmBtn];
self.navigationItem.rightBarButtonItem = confirmBtnBarItem;
0

There are 0 answers