【问题标题】:create a menu drop down menu from button in a table view从表格视图中的按钮创建菜单下拉菜单
【发布时间】:2014-06-08 07:07:36
【问题描述】:

我有一个正确配置和运行的UITableViewController。假设这个控制器的类被称为:tableViewController。在这张桌子上,我有一个 UIBarButton 出现在这样创建的视图的左侧:

UIBarButtonItem *userProfile = [[UIBarButtonItem alloc] initWithTitle:@"Profile" style:UIBarButtonItemStylePlain target:self action:@selector(userProfileGo:)];
self.navigationItem.leftBarButtonItem = userProfile;
self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];

我已经创建了另一个名为 userProfileViewController 的视图控制器,用户可以在其中访问他们的配置文件,它已经配置并以这种方式推送到 userProfileGo:

 [self performSegueWithIdentifier: @"userProfile" sender: self];

我想要做的是当点击 tableViewController 作为一个小窗口时显示用户配置文件 ViewController

这张图代表我的目标:

有没有办法做到这一点?

【问题讨论】:

标签: ios objective-c model-view-controller xcode5 uitableview


【解决方案1】:

您也可以将UIPopoverController+iPhone.h 用于iPhone 中的任何PopOverView(或),例如UIBarButtonItem 的下拉菜单视图@ 参考答案来自:UIPopoverController for iphone not working?

如果您需要滑动菜单,您也可以使用SWRevealViewController Ref : https://github.com/John-Lluch/SWRevealViewController

您也可以参考:https://www.cocoacontrols.com/controls/mlppopupmenu

您还可以调用 menuViewController 的 Instance 并通过使用 Origin 设置框架来添加该 ViewController 的视图,例如 [self.View addSubView:menuViewController.View];。

让我知道它是否有效或有任何查询。

【讨论】:

    【解决方案2】:

    我也有同样的想法,但由于它的低性能和 iOS 用户对它不满意,我开始寻找新的想法,并在 GitHub 上找到了这个库

    看起来像这样:

    这与答案无关,只是我想给你的一个建议。

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多