简体   繁体   中英

CGAffineTransformScale in Monotouch

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

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.

if you want to use it for a UIView:

UIView view = new UIView

view.Transform = CGAffineTransform.MakeScale(1f,1f);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM