mariohahn / MHVideoPhotoGallery

A Photo and Video Gallery
MIT License
1.96k stars 353 forks source link

MediaView Landscape orientation issue on Share Button #117

Open hitendradeveloper opened 9 years ago

hitendradeveloper commented 9 years ago

I am facing an issue while holding device in LandscapOrientation.

To Replicate this issue : Run the example project, select any media then hold the device in Landscape mode, press share button, all the media will be overlapper on upper part of the screen.

I have tried to forcefully call the below code at the end of the viewLoad() of MHShareViewController.m but did not successed.

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; switch (orientation) { case 1: case 2: NSLog(@"portrait"); // your code for portrait... break;

    case 3:
    case 4:{
        NSLog(@"landscape");

            //try one

// self.tableViewShare.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, 240); // self.toolbar.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width,240); // self.collectionView.frame = self.view.bounds; // self.navigationItem.rightBarButtonItem = [self nextBarButtonItem]; // [self.collectionView.collectionViewLayout invalidateLayout];

            //try two

// double delayInSeconds = 1.0; // dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); // dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ // [self willAnimateRotationToInterfaceOrientation:2 duration:0.25]; // [self didRotateFromInterfaceOrientation:2]; // });

    }break;
    default:
        NSLog(@"other");
            // your code for face down or face up...
        break;
}

Please help me to solve out this issue. Thanks for reading this.

mythodeia commented 9 years ago

similar to this?

hitendradeveloper commented 9 years ago

yes, Same as this(https://github.com/mariohahn/MHVideoPhotoGallery/issues/106) link. But no one given solution, that's why I have posted new issue.

suyangdong commented 8 years ago

Same problems happen to me. You might consider force the viewcontroller back to portrait mode when pressing share button...

-(void)sharePressed{

    // Force MHGalleryController to go back to protrait because its shareview has problems in landscape mode
    // http://stackoverflow.com/questions/26357162/how-to-force-view-controller-orientation-in-ios-8
    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
hitendradeveloper commented 8 years ago

Thanks for the Answer. Appreciate your help :+1:

suyangdong commented 8 years ago

You are welcome :-)