Skip to content

Instantly share code, notes, and snippets.

@0xstragner
Last active October 20, 2022 14:19
Show Gist options
  • Save 0xstragner/e3ed070b8f9ec48b19fc3ee705f5133b to your computer and use it in GitHub Desktop.
Save 0xstragner/e3ed070b8f9ec48b19fc3ee705f5133b to your computer and use it in GitHub Desktop.
Medium/UISheetPresentationController/0
@interface ViewController : UIViewController <UIViewControllerTransitioningDelegate>
@end
@implementation ViewController
- (instancetype)init
{
self = [super init];
if (self)
{
self.modalPresentationStyle = UIModalPresentationCustom;
self.transitioningDelegate = self;
}
return self;
}
- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented
presentingViewController:(nullable UIViewController *)presenting
sourceViewController:(UIViewController *)source
{
id klass = NSClassFromString(@"_UISheetPresentationController");
id presentationController = [[klass alloc] initWithPresentedViewController:presented
presentingViewController:presenting];
return presentationController;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment