John Smith
John Smith

Reputation: 12797

Need color to build a custom UIButton to put inside a UIBarButton

I need to build a custom UIBarButton. Most of what I have done works except that I can't get the color of my button to match the iPhone UIBarButton. How can I match it?

Here is what I have: (mostly ripped from Elements sample project)

UIButton *localFlipIndicator=[[UIButton alloc] initWithFrame:CGRectMake(0,0,50,28)];
self.flipIndicatorButton=localFlipIndicator;
[flipIndicatorButton.titleLabel setFont:[UIFont systemFontOfSize:13]];
flipIndicatorButton.layer.cornerRadius=8.0;
flipIndicatorButton.layer.borderWidth=0.5;

[localFlipIndicator release];

[flipIndicatorButton setTitle:@"Back" forState:UIControlStateNormal];

UIBarButtonItem *flipButtonBarItem;
flipButtonBarItem=[[UIBarButtonItem alloc] initWithCustomView:flipIndicatorButton];
style:UIBarButtonItemStylePlain target:self action:@selector(flipCurrentView)];

[self.navigationItem setRightBarButtonItem:flipButtonBarItem animated:YES];

[flipButtonBarItem release];

Upvotes: 0

Views: 261

Answers (1)

Related Questions