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];
The right answer is at
http://www.cimgf.com/2010/01/28/fun-with-uibuttons-and-core-animation-layers/
精彩评论