Seawind Shi
Seawind Shi

Reputation: 143

convert NSAffineTransform to CGAffineTransform

Here is my code from Mac OS X. I want to convert them to IOS.

NSAffineTransform *trans = [NSAffineTransform transform];
[trans translateXBy:(width - self.minWidth) yBy:0.0];
[trans concat];

I have no success to try CGAffineTransform. I even failed in the first step to declare CGAffineTransform.

CGFloat tx=width-self.minWidth;
CGFloat ty=0.0;
CGAffineTransform * trans=CGAffineTransformMakeTranslation(tx, ty);

Error is aka struct CGAffineTransform The purpose is to align everything to the right.

Thanks for you advices

Upvotes: 1

Views: 1140

Answers (1)

tbaranes
tbaranes

Reputation: 3590

You have to remove the * from your variable because CGAffineTransformMakeTranslation returns a CGAffineTransform type, and not an CGAffineTransform *.

Replace

CGAffineTransform * trans=CGAffineTransformMakeTranslation(tx, ty);

By

CGAffineTransform trans=CGAffineTransformMakeTranslation(tx, ty);

Upvotes: 3

Related Questions