我需要两个找不到的按钮:UINavigationBar的Info按钮和Stats按钮。有没有办法找到代表类似事物的按钮而不用画它们?
答案 0 :(得分:4)
希望这可以帮助你:
//for info button using custom UIButton
UIButton *btn = [UIButton buttonWithType:UIButtonTypeInfoDark];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
对于统计数据,没有此类默认按钮可用
答案 1 :(得分:1)
Swift 3/4
let infoButton = UIButton(type: .infoDark)
infoButton.addTarget(self, action: #selector(navbarButtonPressed), for: .touchUpInside)
navigationItem.rightBarButtonItems?.append(UIBarButtonItem(customView: infoButton))