简体   繁体   English

这个故事板转场方法是什么? 推送、模态还是弹出框?

[英]What is this storyboard segue method is this? push, modal, or popover?

在此处输入图片说明

I want to implement same thing like this: a controller popover at the center of screen.我想实现同样的事情:屏幕中央的控制器弹出窗口。 But I cannot find the proper way to present?但我找不到合适的呈现方式? Could you tell me which segue method is this?你能告诉我这是哪种segue方法吗? and how to achieve that?以及如何实现这一目标?

To have menu pop up after performing an action, you have more than one option to do this.要在执行操作后弹出菜单,您有多个选项可以执行此操作。 The easiest way I think is to go to cocoapods.org and find a framework that would do this for you using few lines of code.我认为最简单的方法是访问 cocoapods.org 并找到一个框架,该框架可以使用几行代码为您完成此操作。 Go into cocoapods.org and type "Menu" or "Pop" into the search bar and it would find the best frameworks for that.进入 cocoapods.org 并在搜索栏中输入“Menu”或“Pop”,它会找到最好的框架。 Hope it helps.希望它有帮助。

One quick and easy way of doing that is to layout the popup view on a separate .xib file and then load it in the view controller where you want the popup view to be shown.一种快速简便的方法是将弹出视图布局在单独的 .xib 文件中,然后将其加载到您希望显示弹出视图的视图控制器中。

Here's what you need to do.这是您需要做的。

1) Make a layout of the Popup View by right clicking the project->add new file->User Interface->View. 1)通过右键单击项目->添加新文件->用户界面->视图来制作弹出视图的布局。 Be sure to include the 50% opacity black background in the layout.确保在布局中包含 50% 不透明度的黑色背景。

2) Just load it in the View Controller where you want that to appear. 2)只需将它加载到您希望它出现的视图控制器中。 I assume that you want it to appear by a button click, so you can do it like this:我假设您希望通过单击按钮显示它,因此您可以这样做:

UIView *popupView;

 - (IBAction)showPopupView
{
    popupView = [[[NSBundle mainBundle] loadNibNamed:@"PopupView" owner:self options:nil] objectAtIndex:0];
    [self.view addSubview:popupView];
}

- (IBAction)hidePopupView
{
    [popupView removeFromSuperView];
}

It is a Present Modally segue, presented as a Form Sheet .它是一个Present Modally segue,以Form SheetForm Sheet呈现。 See attachment below见下面的附件在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM