如何在 iPad 中的表格视图单元格上单击显示弹出窗口
我在我的应用程序中使用 TableView,当我单击表格单元格时,我想要一个弹出视图,表格单元格中的所有内容都应该显示在弹出视图中,所以请建议我该怎么做?
我下面有一些示例代码不起作用。所以建议使用代码我希望单元格中的所有内容都显示在弹出视图中。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIView *aView = [[UIView alloc] init];
UIPopoverController *popoverController = [[UIPopoverController alloc]
initWithContentViewController:aView];
popoverController.popoverContentSize = CGSizeMake(320, 416);
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[popoverController presentPopoverFromRect:cell.bounds inView:cell.contentView
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
i am using a TableView in my application where i want a Pop over View when i clicked on a tabel cell, all the content which is in table Cell should display in a pop over view so plz suggest me how to do??
i have some sample code below which is not working..so suggest with code i want all the content in the cell to displayed in the pop over view.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIView *aView = [[UIView alloc] init];
UIPopoverController *popoverController = [[UIPopoverController alloc]
initWithContentViewController:aView];
popoverController.popoverContentSize = CGSizeMake(320, 416);
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[popoverController presentPopoverFromRect:cell.bounds inView:cell.contentView
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
UIPopoverController
< /a> 类参考明确指出您的 popoverController 应该有一个视图控制器而不是视图。
然后你就可以展示这个弹出窗口
The
UIPopoverController
class reference clearly statesYour popoverController should have a view controller and not a view.
Then you can present this pop over
你的代码没问题,但是
您应该使用 UIViewController 而不是 UIView。
Your code is fine, but
You should have UIViewController instead UIView.
你必须传递视图控制器而不是视图
you have to pass the view controller instead of view