Transparent Modal View Controller

iOS8 下很簡單,在 Storyboard 中將 Modal View Controller 設定為
Transition Style: Cover Vertical
Presentation: Over Current Context

iOS7 用上述的方式疊上去後,底下的 vc 會自動被移除,解法是用 UIViewControllerTransitioningDelegate
自行實作轉場動態,這裡是拿 pop 及 popping 來處理轉場動態。
先安裝 pod 'pop'
參考 popping 下的 PresentingAnimator.h/DismissingAnimator.h

#import "PresentingAnimator.h"
#import "DismissingAnimator.h"

#pragma mark - Button Actions
- (IBAction)showingAlert:(id)sender
{
    AlertForSkipImportAddressBookViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"AlertForSkipImportAddressBookViewControllerID"];
    vc.delegate = self;
    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
      [self presentViewController:vc animated:YES completion:nil];  
    }
    else {
    /*Fixed transparent vc is not working in iOS7*/
      vc.transitioningDelegate = self;
      vc.modalPresentationStyle = UIModalPresentationCustom;
      [self presentViewController:vc animated:YES completion:nil];
    }
}

#pragma mark - UIViewControllerTransitioningDelegate
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
                                                                  presentingController:(UIViewController *)presenting
                                                                      sourceController:(UIViewController *)source
{
  return [PresentingAnimator new];
}

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
{
  return [DismissingAnimator new];
}

#pragma mark - AlertForSkipImportAddressBookView Delegate
- (void)clickAlertButtonAtIndex:(NSInteger)buttonIndex
{
  switch (buttonIndex) {
    case AlertButtonIndexCancel:
      break;
      
    case AlertButtonIndexSkip:
      break;

    default:
      break;
  }
}