iPhone、iOS 7的UIPOP概述

iPhone、iOS 7的UIPOP概述,ios,storyboard,uipopovercontroller,Ios,Storyboard,Uipopovercontroller,我需要弹出视图。我遵循了这个指示 初始化:在情节提要中创建两个UIViewController 假设FirstViewController是正常的,而SecondViewController是我们弹出的。 Model Segue:将UIButton放入FirstViewController,并在此UIButton上创建一个Segue作为Model Segue发送给SecondViewController 使透明:现在选择SecondViewController的UIView(默认情况下使用UIV

我需要弹出视图。我遵循了这个指示

初始化:在情节提要中创建两个UIViewController

假设FirstViewController是正常的,而SecondViewController是我们弹出的。 Model Segue:将UIButton放入FirstViewController,并在此UIButton上创建一个Segue作为Model Segue发送给SecondViewController

使透明:现在选择SecondViewController的UIView(默认情况下使用UIViewController创建的UIView),并将其背景色更改为透明色

使背景变暗:在SecondViewController中添加一个UIImageView,该视图覆盖孔屏幕并将其图像设置为某个变暗的半透明图像。您可以从这里获得一个示例:UIAlertView背景图像

显示设计:现在添加一个UIView和make,以及您想要显示的设计类型。这里我展示了我的故事板的屏幕截图

在这里,我添加了登录按钮,打开SecondViewController作为弹出窗口询问用户名和密码

重要提示:现在是主要步骤。我们希望SecondViewController不要完全隐藏FirstViewController。我们设置了清晰的颜色,但这还不够。默认情况下,它会在模型演示文稿后面添加黑色,因此我们必须在FirstViewController的viewDidLoad中添加一行代码。您也可以在其他位置添加它,但它应该在segue之前运行

[self-setModalPresentationStyle:UIModalPresentationCurrentContext]

解雇:什么时候解雇取决于你。这是一个模型演示文稿,因此我们要做我们为模型演示所做的事情:

[自我解除视图控制器激活:是完成:无]

但我使用的是导航控制器,因为透明背景不会出现


请帮帮我。。!!!!下面是我的屏幕截图

我也遇到了同样的问题,并且没有找到解决方案如何在故事板上使用segue来解决它,但是从编程的角度来说,当我在第一个控制器上演示第二个控制器时(使用navigationViewController推送),它的工作很好。如果这对您不重要,请尝试以下方法:

+ (void)showWithParent:(UIViewController *)parentController {
    static SomeViewController *singleton = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        singleton = [storyboard instantiateViewControllerWithIdentifier:@"SomeViewControllerID"];
    });
    [parentController presentViewController:singleton animated:YES completion:nil];
}
或者只是:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SecondViewController *secondController = [storyboard instantiateViewControllerWithIdentifier:@"SecondViewControllerID"];
[firstController presentViewController:secondController animated:YES completion:nil];

freeform
模式下创建一个
视图控制器
,如下图所示

在第一个视图控制器中添加一个
ui按钮
,如下图所示

在第一个视图controller.h中添加以下行

#import "UIPopoverController+iPhone.h"


@interface first view controller : UIViewController<UIPopoverControllerDelegate>


@property (nonatomic,strong) UIPopoverController *popOver;

@property (strong, nonatomic) IBOutlet UIButton *popbtn;
这里是ur
NSObjet
class文件
UIPopoverController+iPhone.h

.h文件

#import <UIKit/UIKit.h>

@interface UIPopoverController (iPhone)
+ (BOOL)_popoversDisabled;
@end
完整的项目代码可通过以下链接获得:


u已应用于图像视图的正确图像。我已经给你的邮件发送了编码??你可以使用弹出视图Fine karthik,,,,,现在我已经检查过了。它起作用了。
#import <UIKit/UIKit.h>

@interface UIPopoverController (iPhone)
+ (BOOL)_popoversDisabled;
@end
#import "UIPopoverController+iPhone.h"

@implementation UIPopoverController (iPhone)
+ (BOOL)_popoversDisabled {
return NO;
}
@end