// // ShareViewController.m // KeleAppProject // // Created by 熊竹 on 2018/3/5. // Copyright © 2018年 Cen Zhou. All rights reserved. // #import "SharePopViewController.h" @interface SharePopViewController () @property(weak, nonatomic) IBOutlet UIView *contentView; @property(weak, nonatomic) IBOutlet UIImageView *shareWechat; @property(weak, nonatomic) IBOutlet UIImageView *shareTimeline; @end @implementation SharePopViewController - (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.contentView.transform = CGAffineTransformMakeTranslation(0, 164); self.shareWechat.userInteractionEnabled = YES; self.shareTimeline.userInteractionEnabled = YES; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.contentView.transform = CGAffineTransformMakeTranslation(0, 0); self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.2]; } completion:nil]; } - (IBAction)cancel:(id)sender { [self dismiss]; } - (IBAction)tapItem:(id)sender { [self dismiss]; if (((UITapGestureRecognizer *) sender).view.tag == 1) { if (self.delegate) { [self.delegate shareWxSession]; } } else if (((UITapGestureRecognizer *) sender).view.tag == 2) { if (self.delegate) { [self.delegate shareWxTimeline]; } } } - (void)dismiss { [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.contentView.transform = CGAffineTransformMakeTranslation(0, 164); 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