在IOS中查看转换[想要更改背景]

时间:2012-03-19 18:07:16

标签: ios xcode background transitions

我对过渡有些怀疑。问题是当我进行转换时:

Register *register1 = [[Register alloc] initWithNibName:nil bundle:nil];
self.registerData = register1;
register1.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:register1 animated:YES];

转换的背景显示为黑色,如下图所示:

enter image description here

你认为我能解决这个问题吗?我想有一个图像来取代这个黑色背景。谢谢!

1 个答案:

答案 0 :(得分:4)

我曾经遇到过同样的问题。在我的例子中,我将一个UIImageView插入到MainWindow的窗口中。请尝试以下代码,看看这是否适合您插入图片:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window.backgroundColor = [UIColor redColor];
}

使用图像而不是颜色:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary 
    UIImageView* background = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    background.image = [UIImage imageNamed:@"Background.png"];
    [self.window addSubview:background];
}