ChooseShareController.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // ChooseShareController.m
  3. // model
  4. //
  5. // Created by Drew on 2018/10/28.
  6. // Copyright © 2018年 Mine. All rights reserved.
  7. //
  8. #import "ChooseShareController.h"
  9. @interface ChooseShareController ()
  10. @property (weak, nonatomic) IBOutlet UIView *contentView;
  11. @property (weak, nonatomic) IBOutlet UIImageView *icon1;
  12. @property (weak, nonatomic) IBOutlet UIImageView *icon2;
  13. @property (weak, nonatomic) IBOutlet UIView *view1;
  14. @property (weak, nonatomic) IBOutlet UIView *view2;
  15. @end
  16. @implementation ChooseShareController
  17. - (instancetype)init {
  18. self = [super init];
  19. if (self) {
  20. self.modalPresentationStyle = UIModalPresentationOverCurrentContext;
  21. self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
  22. self.view.userInteractionEnabled = YES;
  23. }
  24. return self;
  25. }
  26. - (instancetype)initWithCoder:(NSCoder *)coder {
  27. self = [super initWithCoder:coder];
  28. if (self) {
  29. self.modalPresentationStyle = UIModalPresentationOverCurrentContext;
  30. self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
  31. self.view.userInteractionEnabled = YES;
  32. }
  33. return self;
  34. }
  35. - (void)viewDidLoad {
  36. [super viewDidLoad];
  37. self.icon1.layer.cornerRadius = 20;
  38. self.icon1.layer.masksToBounds = YES;
  39. self.icon2.layer.cornerRadius = 20;
  40. self.icon2.layer.masksToBounds = YES;
  41. self.view1.layer.cornerRadius = 20;
  42. self.view1.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.12].CGColor;
  43. self.view1.layer.shadowOffset = CGSizeMake(0,6);
  44. self.view1.layer.shadowOpacity = 1;
  45. self.view1.layer.shadowRadius = 10;
  46. self.view2.layer.cornerRadius = 20;
  47. self.view2.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.12].CGColor;
  48. self.view2.layer.shadowOffset = CGSizeMake(0,6);
  49. self.view2.layer.shadowOpacity = 1;
  50. self.view2.layer.shadowRadius = 10;
  51. self.contentView.transform = CGAffineTransformMakeTranslation(0, self.contentView.bounds.size.height);
  52. }
  53. - (void)viewWillAppear:(BOOL)animated {
  54. [super viewWillAppear:animated];
  55. [UIView animateWithDuration:0.25
  56. delay:0
  57. options:UIViewAnimationOptionCurveEaseOut
  58. animations:^{
  59. self.contentView.transform = CGAffineTransformMakeTranslation(0, 0);
  60. self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
  61. }
  62. completion:nil];
  63. }
  64. - (IBAction)tapShare:(id)sender {
  65. [UIView animateWithDuration:0.25
  66. delay:0
  67. options:UIViewAnimationOptionCurveEaseInOut
  68. animations:^{
  69. self.contentView.transform = CGAffineTransformMakeTranslation(0, self.contentView.bounds.size.height);
  70. self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
  71. }
  72. completion:^(BOOL finished) {
  73. [self dismissViewControllerAnimated:NO completion: ^(void){
  74. if(self.delegate){
  75. switch (((UITapGestureRecognizer*)sender).view.tag) {
  76. case 1:{
  77. [self.delegate shareMember];
  78. break;
  79. }
  80. case 2:{
  81. [self.delegate shareModel];
  82. break;
  83. }
  84. default:
  85. break;
  86. }
  87. }
  88. }];
  89. }];
  90. }
  91. - (IBAction)tapOutside:(id)sender {
  92. [self dismiss];
  93. }
  94. - (void)dismiss {
  95. [UIView animateWithDuration:0.25
  96. delay:0
  97. options:UIViewAnimationOptionCurveEaseInOut
  98. animations:^{
  99. self.contentView.transform = CGAffineTransformMakeTranslation(0, self.contentView.bounds.size.height);
  100. self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
  101. }
  102. completion:^(BOOL finished) {
  103. [self dismissViewControllerAnimated:NO completion:nil];
  104. }];
  105. }
  106. /*
  107. #pragma mark - Navigation
  108. // In a storyboard-based application, you will often want to do a little preparation before navigation
  109. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  110. // Get the new view controller using [segue destinationViewController].
  111. // Pass the selected object to the new view controller.
  112. }
  113. */
  114. @end