Question

Basically I want the button to be hidden initially, and when a some other button is clicked I want to change its transform to the origin, and it doesn't seem to be working.

- (void)viewDidLoad
{
   [super viewDidLoad];

   self.btn.transform = CGAffineTransformScale(self.btn.transform, 0.01, 0.01);
}

- (IBAction)buttonClicked:(id)sender
{
   [UIView animateWithDuration:.3 animations:^{
       self.btn.transform = CGAffineTransformScale(self.btn.transform, 1, 1);
   }
}
Était-ce utile?

La solution

CGAffineTransformScale

Returns an affine transformation matrix constructed by scaling an existing affine transform.

So

self.btn.transform = CGAffineTransformScale(self.btn.transform, 1, 1);

will do nothing. You should change it to

self.btn.transform = CGAffineTransformIdentity;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top