简体   繁体   English

情节提要ViewController中的透明背景

[英]transparent background in storyboard viewcontroller

I am making an login screen. 我正在登录屏幕。 I have the following storyboard. 我有以下情节提要。 在此处输入图片说明

What I'm doing in code is. 我在代码中所做的是。 If there is a username and password stored on the device. 设备上是否存储了用户名和密码。 Than passViewController pops up. 比passViewController弹出。 Else login viewcontroller pops up. 弹出其他登录viewcontroller。 This works fine. 这很好。

The problem I have is that LoginViewController and PassViewController should have a transparent background. 我的问题是LoginViewController和PassViewController应该具有透明背景。 I know how to do this with a single xib file but I want to do this in my storyboard so that I can use my segues from Login and Passviewcontroller to the nextController. 我知道如何使用单个xib文件执行此操作,但我想在情节提要中执行此操作,以便可以使用从Login和Passviewcontroller到nextController的序列。 At the moment I'm doing this in code. 目前,我正在用代码执行此操作。

   UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
        UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
        vc.view.backgroundColor = [UIColor clearColor];
        self.modalPresentationStyle = UIModalPresentationCurrentContext;
        [self presentModalViewController:vc animated:YES];

Can anybody help me how I can achieve this. 谁能帮助我实现这一目标。

Kind regards. 亲切的问候。

If my understanding is correct, you just need to click on your view controller's view, for instance, your LoginViewController's view. 如果我的理解是正确的,则只需单击视图控制器的视图,例如LoginViewController的视图。 That's the 1st view in your controller's views hierarchy. 那是控制器视图层次结构中的第一个视图。 Then in the attributes inspector, on your screen's right side, you can set the view's background colour to 'clear colour'. 然后,在属性检查器的屏幕右侧,可以将视图的背景色设置为“纯色”。 Is that what you're looking for? 那是您要找的东西吗?

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

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