Created
September 26, 2015 06:53
-
-
Save nolili/1a17ddcbca68fba33f39 to your computer and use it in GitHub Desktop.
3D touch Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ViewController.h" | |
@interface ViewController () <UIViewControllerPreviewingDelegate> | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self registerForPreviewingWithDelegate:self sourceView:self.view]; | |
} | |
#pragma mark - UIViewControllerPreviewingDelegate | |
- (nullable UIViewController *)previewingContext:(id <UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location{ | |
UIViewController *viewController = [[UIViewController alloc] init]; | |
viewController.view.backgroundColor = [UIColor redColor]; | |
return viewController; | |
} | |
- (void)previewingContext:(id <UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit | |
{ | |
[self presentViewController:viewControllerToCommit animated:YES completion:nil]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment