Objective c - UIActivityViewController orientation mode

前端 未结 4 1449
鱼传尺愫
鱼传尺愫 2021-01-21 09:40

My iPhone app is design to support portrait orientation only, except one view controller that present photos, and support landscape mode as well.

So overall my project

4条回答
  •  无人共我
    2021-01-21 10:38

    You should make another uinavigationcontroller and present uiactivityviewcontroller from there. In this code _image is a UIImage yo wan to share. BlankViewController is just place holder viewcontroller you can create in IB you can also make it's view's background colour to clear and do what ever appearance changes you want to do.

    __weak  CurrentViewController  *weakSelf    =   self  ;
    
    UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[_image] applicationActivities:nil]   ;
    UIViewController        *viewC  =   [[UIViewController alloc] initWithNibName:@"BlankViewController" bundle:nil] ;
    UINavigationController  *navC   =   [[UINavigationController alloc] initWithRootViewController:viewC]  ;
    activityViewController.completionHandler = ^(NSString *activityType, BOOL completed)
    {
        [weakSelf dismissViewControllerAnimated:NO completion: ^ {
            ;    // Your completion handler
        }]  ;
    };
    [self presentViewController:navC animated:NO completion: ^ {
        [navC presentViewController:activityViewController animated:YES completion: ^ {
            ;
        }]  ;
    }];
    

提交回复
热议问题