2016-11-25 17 views
1

我想製作一個菜單動畫,如下所示。製作菜單來自iOS中的左角落

enter image description here

我需要裏面的菜單UIButtons。 我怎樣才能做到這一點。

+1

您是否創建了一個顯示菜單的視圖? –

+1

其實我想決定UIView或添加目標UIViewController將完成的事情。 – Saranjith

+1

這個菜單是用在所有的控制器,你有菜單,然後它的麪糊使用這種菜單的一些庫 –

回答

2

這個動畫您應該默認設置錨點的定位點位置爲(0.5,0.5),所以可以改變錨點的位置:

所有幾何操作的觀點發生有關指定點。例如,將旋轉變換應用於具有默認錨點的圖層會導致圖層圍繞其中心旋轉。將錨點更改爲其他位置會導致圖層圍繞該新點旋轉。

self.view.layer.anchorPoint = CGPointMake(0,0); 

self.view.transform = CGAffineTransformMakeScale(0.001,0.001); 

[UIView animateWithDuration:1.0 animations:^{ 
      self.view.transform = CGAffineTransformIdentity; 

    }]; 
+0

動畫效果很好。我需要在我所有的視圖控制器中都有這個視圖。 – Saranjith

+1

在所有視圖控制器中添加子視圖。 @Saranjith –

1

請添加按鈕點擊如下代碼:

[UIView animateWithDuration:1 
       animations:^{ 
        myView.transform = CGAffineTransformMakeScale(1.5, 1.5); } 
       completion:^(BOOL finished) { 
        [UIView animateWithDuration:1 
             animations:^{ 
              myView.transform = CGAffineTransformIdentity; 
             }]; }]; 

它會爲你工作。

0

創建超類SuperViewController.m 添加這種方法

- (void)viewDidLoad { 

    [super viewDidLoad]; 

    //Here u can set image also in navigation bar 
    UIBarButtonItem *buttonC = [[UIBarButtonItem alloc]initWithTitle:@"Word" style:UIBarButtonItemStylePlain target:self action:@selector(GeTVAlue)]; 

    [self.navigationItem setLeftBarButtonItem:buttonC]; 
} 
-(void)GeTVAlue{ 

    UIView *paintView=[[UIView alloc]initWithFrame:CGRectMake(-350, -350, 350, 350)]; 
    [paintView setBackgroundColor:[UIColor yellowColor]]; 
    [self.view addSubview:paintView]; 

    [UIView animateWithDuration:1 
       animations:^{ 
        paintView.transform = CGAffineTransformMakeScale(2.5, 2.5); } 
       completion:^(BOOL finished) { 
        [UIView animateWithDuration:1 
             animations:^{ 
              paintView.transform = CGAffineTransformIdentity; 
             }]; }]; 
} 

然後在繼承類的超級類

@interface TheerdViewController:SuperViewController

如果你有任何問題請填寫問我。 Thnak you