I am trying to translate this centering code snip in Objective-C into MonoTouch
imageView.frame.origin.x = CGRectGetMidX(view.bounds) -
CGRectGetMidX(imageView.bounds)
But can’t find where Origin is.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
MonoTouch maps
GCRecttoSystem.Drawing.RectangleFsince it’s closer to what .NET developers have been using (e.g. System.Drawing / Windows Forms…).As such
imageView.frame.origin.xwill becomeimageView.Frame.Location.Xwhich can simplified byimageView.Frame.X.If you add
using MonoTouch.CoreGraphics;to your source file you’ll get extension methods that will provide you withCGRectGetMidXreplacement, e.g.So
should become