简体   繁体   中英

Add a 'global' UIView to an App with StoryBoard

Is there a way to create a global UIView as background with the use of a StoryBoard? I am updating my App, and making iOS 5 as the minimum so I can use ARC and also StoryBoards.

However, in my App I used a MainView.xib which I loaded as my rootviewcontroller, and any subsequent view was transparent so the background (and a button/copyright notice) were always visible.

I don't seem to be able to figure out how to do this. I can add the Subview to the rootview controller in the AppDelegate, but as soon as I seque to the next view it is gone.

Any suggestions how this can be done?

One way you can do this by adding an image view as a subview of the window itself, and making the backgrounds of all the view controllers clear.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    UIImageView *iv = [[UIImageView alloc] initWithFrame:self.window.frame];
    iv.image = [UIImage imageNamed:@"BlueGreenGradient.tiff"];
    [self.window addSubview:iv];
    return YES;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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