Thursday, 15 April 2010

iphone - iOS - entire View shifts up after rotation -



iphone - iOS - entire View shifts up after rotation -

doing simple ipad app plays video in fullscreen. want video centered, on initial load it's bit far down. when rotate it, view resets centered. i'd love have way start.

here's code in viewdidload:

nsurl *url = [nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"movie" oftype:@"m4v"]]; movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:url]; [movieplayer preparetoplay]; cgrect screenbounds = [uiscreen mainscreen].bounds; [movieplayer.view setframe:cgrectmake(0, 0, screenbounds.size.height, screenbounds.size.width)]; [self.view addsubview:movieplayer.view]; movieplayer.controlstyle = mpmoviecontrolstylefullscreen; [movieplayer play]; [super viewdidload];

the app set show in landscape mode, rotation takes effect every 180 degrees (instead of 90). btw movieplayer var set in .h file so:

@property (nonatomic, strong) mpmovieplayercontroller *movieplayer;

then it's synthesized in viewcontroller:

@synthesize movieplayer;

so have ideas? tried changing "setframe" start @ 0,-20 instead of 0,0 messed things on later rotations. if there's way ignore dumb status bar on initial load, i'd love know it. thanks.

try calling

[self setwantsfullscreenlayout:yes];

in viewcontroller implementation. should forcefulness "ignore dumb status bar on initial load".

iphone ios ipad video

No comments:

Post a Comment