Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)openCreateQuickQuoteVC {
  2.     for (id childVC in self.childViewControllers) {
  3.         if ([childVC isKindOfClass:[CBGCreateQuoteMainViewController class]]) {
  4.             return;
  5.         }
  6.     }
  7.     CBGCreateQuoteMainViewController *createQuickQuote = [self.storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([CBGCreateQuoteMainViewController class])];
  8.     createQuickQuote.delegate = self;
  9.    
  10.     [self addChildViewController:createQuickQuote];
  11.     [self.view addSubview:createQuickQuote.view];
  12.     [createQuickQuote didMoveToParentViewController:self];
  13.    
  14.     __weak typeof(self) weakSelf = self;
  15.     createQuickQuote.view.frame = CGRectMake(0.f, CGRectGetHeight(self.view.bounds), CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds) - kCBGTabBarHeight);
  16.     [UIView animateWithDuration:0.3f
  17.                           delay:0.f
  18.                         options:UIViewAnimationOptionCurveEaseInOut
  19.                      animations:^{
  20.                          createQuickQuote.view.frame = CGRectMake(0.f, 0.f, CGRectGetWidth(weakSelf.view.bounds), CGRectGetHeight(weakSelf.view.bounds) - kCBGTabBarHeight);
  21.                      } completion:nil];
  22. }
  23.  
  24. #pragma mark - CBGCreateQuoteMainViewControllerDelegate
  25.  
  26. - (void)createQuoteMainViewControllerDidCancelButtonClicked:(CBGCreateQuoteMainViewController *)viewController {
  27.     [viewController willMoveToParentViewController:nil];
  28.    
  29.     __weak typeof(self) weakSelf = self;
  30.     __block typeof(viewController) blockViewController = viewController;
  31.     [UIView animateWithDuration:0.3f
  32.                           delay:0.f
  33.                         options:UIViewAnimationOptionCurveEaseInOut
  34.                      animations:^{
  35.                          blockViewController.view.frame = CGRectMake(0.f, CGRectGetHeight(weakSelf.view.bounds), CGRectGetWidth(weakSelf.view.bounds), CGRectGetHeight(weakSelf.view.bounds) - kCBGTabBarHeight);
  36.                      } completion:^(BOOL finished) {
  37.                          [blockViewController.view removeFromSuperview];
  38.                          [blockViewController removeFromParentViewController];
  39.                      }];
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement