2014-04-12 86 views
0

我想使動畫MenuView顯示。UIView動畫不可見

當我打電話時 - showSideMenuMenuView未出現。

我該如何解決?

MenuView.h

#import <UIKit/UIKit.h> 

@interface SettingView : UIView 

@end 

MenuView.m

- (id)initWithFrame:(CGRect)frame 
{ 
    self = [super initWithFrame:frame]; 
    if (self) 
    { 
     self.frame = CGRectMake(320, 0, 240, 568); 
     self.backgroundColor = [UIColor turquoiseColor]; 
    } 
    return self; 
} 

MasterViewController.m

@property (nonatomic, strong) MenuView* sideMenuView; 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    UIBarButtonItem* menuButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(showSideMenu:)]; 
    self.navigationItem.rightBarButtonItem = menuButton; 

    self.sideMenuView = [[MenuView alloc]initWithFrame:self.view.frame]; 
    [self.view addSubview:self.sideMenuView]; 
} 

- (IBAction)showSideMenu:(id)sender 
{ 
    [UIView animateWithDuration:0.3f 
          delay:0.0f 
         options:UIViewAnimationOptionCurveEaseIn 
        animations:^{ 
         self.sideMenuView.frame = CGRectMake(80, 0, 240, 568); 
        } 
        completion:^(BOOL finished) { 
        }]; 
} 
+1

會發生什麼?你調試了嗎? – Wain

+0

檢查此** http://stackoverflow.com/questions/22522949/change-a-uiview-frame/22523357#22523357** –

回答

0

幾件事情:

  • 把一個NSLog放在showSideMenu方法中。它實際上是火嗎?
  • 您可以爲框架設置動畫。 您是否已經爲此視圖控制器關閉了AutoLayout?