将 UIImagePickerController 与 UINavigationController 结合使用

发布于 2024-09-08 14:22:36 字数 165 浏览 3 评论 0原文

所以我有一个 UINavigationController 从 rootViewController 推送 UITableViewController。从 UITableViewController 中,我希望当我单击某个单元格时推送 UIImagePickerController。如何让导航控制器显示图像选择器?

So I have a UINavigationController that pushes a UITableViewController from the rootViewController. From the UITableViewController, I want a UIImagePickerController to be pushed when I click a certain cell. How would I get the navigation controller to display the image picker?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤星 2024-09-15 14:22:36
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    {
       UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
       imagePicker.delegate = self;

       [self presentModalViewController:imagePicker animated:YES];
       // don't release imagePicker here
    }

然后定义 UIPickerControllerDelegate 在你的 tableViewController 实现中。

  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    {
       UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
       imagePicker.delegate = self;

       [self presentModalViewController:imagePicker animated:YES];
       // don't release imagePicker here
    }

Then define UIPickerControllerDelegate in your tableViewController implementation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文