开发者

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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜