// // ChooseShareController.m // model // // Created by Drew on 2018/10/28. // Copyright © 2018年 Mine. All rights reserved. // #import "ChooseShareController.h" @interface ChooseShareController () @property (weak, nonatomic) IBOutlet UIView *contentView; @property (weak, nonatomic) IBOutlet UIImageView *icon1; @property (weak, nonatomic) IBOutlet UIImageView *icon2; @property (weak, nonatomic) IBOutlet UIView *view1; @property (weak, nonatomic) IBOutlet UIView *view2; @end @implementation ChooseShareController - (instancetype)init { self = [super init]; if (self) { self.modalPresentationStyle = UIModalPresentationOverCurrentContext; self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0]; self.view.userInteractionEnabled = YES; } return self; } - (instancetype)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { self.modalPresentationStyle = UIModalPresentationOverCurrentContext; self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0]; self.view.userInteractionEnabled = YES; } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.icon1.layer.cornerRadius = 20; self.icon1.layer.masksToBounds = YES; self.icon2.layer.cornerRadius = 20; self.icon2.layer.masksToBounds = YES; self.view1.layer.cornerRadius = 20; self.view1.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.12].CGColor; self.view1.layer.shadowOffset = CGSizeMake(0,6); self.view1.layer.shadowOpacity = 1; self.view1.layer.shadowRadius = 10; self.view2.layer.cornerRadius = 20; self.view2.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.12].CGColor; self.view2.layer.shadowOffset = CGSizeMake(0,6); self.view2.layer.shadowOpacity = 1; self.view2.layer.shadowRadius = 10; self.contentView.transform = CGAffineTransformMakeTranslation(0, self.contentView.bounds.size.height); } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.contentView.transform = CGAffineTransformMakeTranslation(0, 0); self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3]; } completion:nil]; } - (IBAction)tapShare:(id)sender { [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.contentView.transform = CGAffineTransformMakeTranslation(0, self.contentView.bounds.size.height); self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0]; } completion:^(BOOL finished) { [self dismissViewControllerAnimated:NO completion: ^(void){ if(self.delegate){ switch (((UITapGestureRecognizer*)sender).view.tag) { case 1:{ [self.delegate shareMember]; break; } case 2:{ [self.delegate shareModel]; break; } default: break; } } }]; }]; } - (IBAction)tapOutside:(id)sender { [self dismiss]; } - (void)dismiss { [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.contentView.transform = CGAffineTransformMakeTranslation(0, self.contentView.bounds.size.height); self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0]; } completion:^(BOOL finished) { [self dismissViewControllerAnimated:NO completion:nil]; }]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end