在Storyboard中添加弹出控制器时出错

时间:2015-04-12 00:00:49

标签: ios uiview controller

  

// // PopupViewController.h // TheStore

     
    

// //由Daniel Habshush于11.04.15创建。 //版权所有(c)2015     H公司。版权所有。 //

  
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "AppDelegate.h"

@interface PopupViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIView *popUpView;

- (void)showInView:(UIView *)aView animated:(BOOL)animated;

@end
  

// // PopupViewController.m // TheStore // //由Daniel创建   Habshush于11.04.15。 //版权所有(c)2015 H Company。所有权利   保留。 //

#import "PopupViewController.h"

@interface PopupViewController ()

@end

@implementation PopupViewController

    - (void)viewDidLoad
    {
        self.view.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:.6];
        self.popUpView.layer.cornerRadius = 5;
        self.popUpView.layer.shadowOpacity = 0.8;
        self.popUpView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
        [super viewDidLoad];

    }
        - (void)showAnimate
        {
        self.view.transform = CGAffineTransformMakeScale(1.3, 1.3);
        self.view.alpha = 0;
        [UIView animateWithDuration:.25 animations:^{
        self.view.alpha = 1;
        self.view.transform = CGAffineTransformMakeScale(1, 1);
        }

        - (void)removeAnimate
    {
        [UIView animateWithDuration:.25 animations:^{
        self.view.transform = CGAffineTransformMakeScale(1.3, 1.3);
        self.view.alpha = 0.0;
        } completion:^(BOOL finished) {
        if (finished) {
        [self.view removeFromSuperview];
                }
            }];
        }


- (IBAction)closePopup:(id)sender {
            [self removeAnimate];
        }

- (void)showInView:(UIView *)aView animated:(BOOL)animated
        {
            [aView addSubview:self.view];
            if (animated) {
                [self showAnimate];
            }
        }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
@end
         }
@end

所以,我的问题是:

我想在main.storyboard中添加一个PopupView控制器,但不能以某种方式解决上一个错误。

1 个答案:

答案 0 :(得分:0)

您在showAnimate方法中缺少结束大括号,这会在以下方法中出现错误。