我想将标题和按钮添加到UIPopoverController

时间:2012-09-17 19:44:41

标签: ios ipad uiviewcontroller uipopovercontroller

我想在UIPopoverController中添加标题和按钮。使用我当前的代码

- (IBAction)listOfDocumnetsInSections:(id)sender {

UIViewController *listViewController = [[UIViewController alloc] init];
self.lsitOfDocument = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, 300, [self countRecordsInEntity] * 43) style:UITableViewStylePlain];
self.lsitOfDocument.dataSource = self;
self.lsitOfDocument.delegate = self;

[listViewController.view addSubview:self.lsitOfDocument];
self.listOfSectionsPopOver = [[UIPopoverController alloc] initWithContentViewController:listViewController];

[self.listOfSectionsPopOver setPopoverContentSize:CGSizeMake(300, [self countRecordsInEntity] * 43)];
[self.listOfSectionsPopOver presentPopoverFromRect:CGRectMake(700, 35, 10, 10)
                                            inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny
                                          animated:YES];}

看起来像是

enter image description here

但我喜欢改变UI,如下所示

enter image description here

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

几个选项:

  1. 将UIToolbar添加到视图顶部
  2. 为包含UIToolbar的UITableView创建一个标题页
  3. UIToolbar将包含标签和按钮