开发者

Overlaying the screen with a black rectangle?

开发者 https://www.devze.com 2023-02-20 16:17 出处:网络
I\'d like to, when my iPhone app first loads up, overlay the entire screen with a black rectangle temporarily.It would cover everything beneath it, so that everything on the screen would be black for

I'd like to, when my iPhone app first loads up, overlay the entire screen with a black rectangle temporarily. It would cover everything beneath it, so that everything on the screen would be black for a moment.

Anyone 开发者_Python百科know how to write the code to do this? It would help if you could specify how to remove the rectangle after an allotted time.

Thanks.


Maybe you can do what you want with that, assuming you rectangle is an image :

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIImage *img = [UIImage imageNamed:@"black_rectangle.png"];
    UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
    imgView.frame = CGRectMake(0.f, 0.f, 320.f, 480.f);
    [self.view addSubview:imgView];

    [NSTimer scheduledTimerWithTimeInterval:_YOUR_TIME_
                                     target:self
                                   selector:@selector(timerFinished:)
                                   userInfo:imgView
                                    repeats:NO];
    [imgView release];
}

- (void)timerFinished:(NSTimer *)timer
{
    UIImageView *imgView = (UIImageView *)[timer userInfo];
    [imgView removeFromSuperview];
}


Do you mean splash screen? You can use this tutorial for this.

http://www.icodeblog.com/2009/03/18/iphone-game-programming-tutorial-part-3-splash-screen/

and btw Apple doesn't recommend using splash screen in Human Interface Guidelines

0

精彩评论

暂无评论...
验证码 换一张
取 消