문제

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);
   }
}
도움이 되었습니까?

해결책

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top