Reputation: 21
I am new to Monotouch, can anybody answer what i need to do to get access to use CGAffineTransformScale method in C#. I added structure ( using MonoTouch.CoreGraphics; ) but still I can't use the method. Thanks for any attempt
Upvotes: 2
Views: 2317
Reputation: 461
if you want to use it for a UIView:
UIView view = new UIView
view.Transform = CGAffineTransform.MakeScale(1f,1f);
Upvotes: 2
Reputation: 8170
Usually, the ObjC functions that create new instances of classes or structures are wrapped in MonoTouch as static methods of the types of these classes or structures. If these functions perform an operation on an already existing instance of an object, they are wrapped as instance methods.
So for example, the ObjC CGAffineTransformScale function is wrapped as an instance method of the CGAffineTransform
struct:
CGAffineTransform transform = CGAffineTransform.MakeIdentity();
transform.Scale(1f, 1f);
An easy way to find which is the case when you are reading Apple documentation on a function is this: if the function accepts as its first parameter an instance of the object it will modify, it will most likely be wrapped in MonoTouch as an instance method. If it is not, it will be wrapped as a static method. In most cases at least.
Upvotes: 7