In my app,I am playing video using MPMoviePlayer. I am adding a "Skip Ad" (you can see that on the right side of movie player)button on Movie Player.It works fine in iOS5, but when I run my app in iOS6, the button is hidden when Movieplayer becomes fullscreen.
Why this happens..any idea ? Help me to overcome this..thanks in advance
Here are the code for adding button on MPMovieplayer,and the screen shots
UIButton *skipButton = [UIButton buttonWithType:UIButtonTypeCustom];
skipButton.frame = CGRectMake(264.0,195.0, 67.0, 25.0);
[skipButton setTitle:@"" forState:UIControlStateNormal];
skipButton.backgroundColor = [UIColor clearColor];
[skipButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal ];
UIImage *buttonImageNormal3 = [UIImage imageNamed:@"skipad.png"];
UIImage *strechableButtonImageNormal3 = [buttonImageNormal3 stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[skipButton setBackgroundImage:strechableButtonImageNormal3 forState:UIControlStateNormal];
UIImage *buttonImagePressed3 = [UIImage imageNamed:@"skipad.png"];
UIImage *strechableButtonImagePressed3 = [buttonImagePressed3 stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[skipButton setBackgroundImage:strechableButtonImagePressed3 forState:UIControlStateHighlighted];
[skipButton addTarget:self action:@selector(skipAction:) forControlEvents:UIControlEventTouchUpInside];
[[[UIApplication sharedApplication] keyWindow] addSubview:skipButton];
in iOS5 -
in iOS6 -
bringSubviewToFront should work, just make sure you're using it correctly. The usage is:
[skipButton.superview bringSubviewToFront:skipButton];
If that doesn't work you can change the zPosition like so:
skipButton.layer.zPosition = 1024.0;