<分区>
我想在我的 iPad 应用程序中开发一个弹出窗口。 UIButton 触发器将调用弹出窗口,并且该弹出窗口将包含一个 UITableViewController。
首先我需要一个弹出窗口。
需要一些示例代码或说明或链接。
提前致谢。
<分区>
我想在我的 iPad 应用程序中开发一个弹出窗口。 UIButton 触发器将调用弹出窗口,并且该弹出窗口将包含一个 UITableViewController。
首先我需要一个弹出窗口。
需要一些示例代码或说明或链接。
提前致谢。
最佳答案
在您的 View Controller 中,在按钮操作上编写此代码:
- (IBAction)openAllRhymes:(id)sender{
UIButton *button = (UIButton*)sender;
PopupTableView *tableViewController = [[PopupTableView alloc] initWithStyle:UITableViewStylePlain];
popover = [[UIPopoverController alloc] initWithContentViewController:tableViewController];
[popover presentPopoverFromRect:CGRectMake(button.frame.size.width / 2, button.frame.size.height / 1, 1, 1) inView:button permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[tableViewController release];
}
现在您已经在该 tableviewcontroller 中为 popover 创建了一个 tableview 写入:
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(108,400);
关于ios - 如何在 iPad 中创建 Popover?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6939493/