Domanda

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);
   }
}
È stato utile?

Soluzione

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;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top