开发者

how should I draw Custom button on Navigation Bar

I want to draw custom button on Navigat开发者_如何学Pythonion bar.

Can anybody help me.


simple

[[UIBarButtonItem alloc] initWithCustomView: customButton];

will work

so something like that:

UIButton *button = [UIButton buttonWithType: UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:@"animage.png"]];
[button addTarget:self action:@selector(onClick:) forControlEvents: UIControlEventTouchUpInside];
UIBarButtonItem *customItem = [[UIBarButtonItem alloc] initWithCustomView: button];
[self.navigationItem setLeftBarButtonItem:customItem];

Cheers, Krzysztof Zabłocki


UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"DontWorryAboutThis" style:UIBarButtonItemStylePlain target:self action:@selector(method:)];
[barButton setImage:[UIImage imageNamed:@"animage.png"]];
[self.navigationItem setLeftBarButtonItem:barButton];


      UIBarButtonItem *btn=[[UIBarButtonItem alloc] initWithTitle:@"Button" style:UIBarButtonItemStylePlain target:self action:@selector(btnPressed)];
      [self.navigationItem setRightBarButtonItem:btn];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜