我试图在导航控制器的顶部栏添加刷新按钮但没有成功.
这是标题:
@interface PropertyViewController : UINavigationController {
}
Run Code Online (Sandbox Code Playgroud)
以下是我尝试添加它的方法:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Show" style:UIBarButtonItemStylePlain
target:self action:@selector(refreshPropertyList:)];
self.navigationItem.rightBarButtonItem = anotherButton;
}
return self;
}
Run Code Online (Sandbox Code Playgroud)