作者level39 (tingyu)
站内MacDev
标题Re: [问题] 有关navigation 返回按钮 图形
时间Thu Nov 15 21:44:36 2012
※ 引述《j5307 (JJ)》之铭言:
: 在做返回按钮时
: self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
: initWithTitle:@"影片清单"
: style:UIBarButtonItemStylePlain
: target:self
: action:@selector(backToHome:)];
: 会执行backToHom方法
: 而此时 返回按钮的 图形是 矩形
: 而欲想改成 rectangle shape 左边有箭头的矩形
: UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
: initWithTitle:@"影片清单"
: style:UIBarButtonItemStylePlain
: target:self
: action:@selector(backToHome:)];
: self.navigationItem.backBarButtonItem = backButton;
: 可以产生有箭头的矩形 但是却无法呼叫backToHome
: 所以似乎是无法实现这部分的动作
UIButton *customButton = [UIButton buttonWithType:xxxxx];
[customButton addTarget:self action@selector(backToHome:) forControlEvent:xxx];
反正就这个button要什麽样子你就自己做一个出来,然後:
self.navigationItem.leftButtonItem = [[UIBarButtonItem alloc] initWithcustomView:customButton];
这样就可以了
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 111.243.139.152
1F:推 j5307:谢谢分享罗 11/16 11:22