Madhumitha
Madhumitha

Reputation: 3824

CGAffineTransformMakeRotation scale down my image

I am using CGAffineTransformMakeRotation to rotate my button.But my button getting scaled(big or small) according to my value to rotate.How to stop scaling of my button? sample code i have used

 UIView.animateWithDuration(2.5, animations: {
        self.btnMeter.transform = CGAffineTransformRotate(CGAffineTransformIdentity, (45 * CGFloat(M_PI)) / 180.0) 

    })

Upvotes: -1

Views: 176

Answers (2)

Madhumitha
Madhumitha

Reputation: 3824

I have kept my button on UIView.After that I have rotated my view using the same code.It works fine.

Upvotes: 0

techloverr
techloverr

Reputation: 2617

try this

UIView.animateWithDuration(2.5, animations: {
    btnMeter.transform = CGAffineTransformRotate(btnMeter.transform, (45 * CGFloat(M_PI)) / 180.0)

})

and put this in viewdidAppear instead of viewDidLoad

Upvotes: 0

Related Questions