Saranjith
Saranjith

Reputation: 11567

Making Menu coming From Left Corner in iOS

I want to make an Menu Animation just as shown below.

enter image description here

I need to have UIButtons inside the menu. How can i achieve this.

Upvotes: 1

Views: 161

Answers (3)

Sanandiya Vipul
Sanandiya Vipul

Reputation: 764

Create Super class SuperViewController.m Add this method

- (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;
                                      }]; }];
}

Then Inherit your Super class in your class

@interface TheerdViewController : SuperViewController

If u have any question fill free ask me. Thnak you

Upvotes: 0

User511
User511

Reputation: 1486

Please add the follow code on button click:

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

It will work for you.

Upvotes: 1

Saurabh Jain
Saurabh Jain

Reputation: 1698

for this animation you should set anchor point by default the anchor point position is (0.5,0.5), so can change the anchor point position:

All geometric manipulations to the view occur about the specified point. For example, applying a rotation transform to a layer with the default anchor point causes the layer to rotate around its center. Changing the anchor point to a different location would cause the layer to rotate around that new point.

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

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

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

   }];

Upvotes: 2

Related Questions