objective-c - UIPopoverController 顶部的按钮

标签 objective-c ipad

我想在 UIPopoverController 顶部添加两个按钮,如下面的屏幕截图所示: HTML Edit

谢谢你帮助我!

最佳答案

将 View Controller 添加到 UINavigationController,然后将导航 Controller 添加到 UIPopoverController。然后在您的 UIViewController 的 viewDidLoad 方法中,将此代码放入:

UIBarButtonItem *okButton = [[UIBarButtonItem alloc] initWithTitle:@"Ok" style:UIBarButtonItemStyleBordered target:self action:@selector(okayButtonPressed)];
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(cancelButtonPressed)];

self.navigationItem.title = @"My Title";

[self.navigationItem setLeftBarButtonItem:cancelButton animated:NO];
[self.navigationItem setRightBarButtonItem:okButton animated:NO];

[cancelButton release];
[okButton release];

关于objective-c - UIPopoverController 顶部的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2828103/

相关文章:

c++ - O'Reilly 的 "Objective-C Pocket Reference"声称 C++ 不支持动态调度,这是真的吗?

javascript - 使用蓝牙扫描仪/键盘在 iOS/Safari 上收听 HTML/JavaScript 中的按键,而无需专注于某个领域

iphone - 调用方式 - (CGFloat)tableView :(UITableView *)tableView heightForFooterInSection:(NSInteger)section without reloading

iphone Mail App Popup 样式 alertview

ios - 为什么 UITextfield.text 从数组中检索时返回精确的 float ?

ios - CoreData - 更新模型类而不是创建新的

iphone - 在静态库中使用时 RestKit 不工作

ios - 作为框架开发人员,为什么我不能强制 iPad 上的 UIViewController 方向为纵向?

javascript - 使用 HTML5 在 Safari 浏览器中录制音频?

jquery - HTML5 视频全屏不适用于 iPad