chanpkr
chanpkr

Reputation: 915

iOS CGAffineTransform on UIView

// view controller implementation
@property (weak, nonatomic) IBOutlet UIView *v;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
     // Do any additional setup after loading the view, typically from a nib.
     //self.v.layer.backgroundColor = [UIColor blackColor].CGColor;
     CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_4);
     self.v.layer.affineTransform = transform;
}

@end

I've successfully connected UIView *v to a UIView object in the interface builder. But for some reason, when self.v.layer.affineTransform = transform; is executed, the v disappears from the screen when I build and run it. What is wrong with this? and how do I fix this? On a side note, I set the object's background color blue so it's visible on screen.

Upvotes: 0

Views: 546

Answers (1)

Pradip Vanparia
Pradip Vanparia

Reputation: 1742

self.v.transform = CGAffineTransformRotate(CGAffineTransformIdentity, M_PI_4);

Try this.

Upvotes: 2

Related Questions