예제 #1
0
        public static MGTransform TransformAttribute(MGAttribute attr, float val)
        {
            MGTransform a = new MGTransform();

            a.Attribute = attr;
            a.Value     = val;
            a.Curve     = MGTransformCurve.Linear;

            return(a);
        }
예제 #2
0
        private nfloat GetViewAttribute(MGAttribute attribute, UIView view)
        {
            switch (attribute)
            {
            case MGAttribute.X:
                return(view.Frame.X);

            case MGAttribute.Y:
                return(view.Frame.Y);

            case MGAttribute.Width:
                return(view.Frame.Size.Width);

            case MGAttribute.Height:
                return(view.Frame.Size.Height);

            case MGAttribute.Alpha:
                return(view.Alpha);

            case MGAttribute.CornerRadius:
                return(view.Layer.CornerRadius);

            case MGAttribute.ShadowOpacity:
                return(view.Layer.ShadowOpacity);

            case MGAttribute.ShadowRadius:
                return(view.Layer.ShadowRadius);

            case MGAttribute.FontSize:
                if (view is UILabel)
                {
                    return(((UILabel)view).Font.PointSize);
                }
                else if (view is UIButton)
                {
                    return(((UIButton)view).TitleLabel.Font.PointSize);
                }
                else if (view is UITextField)
                {
                    return(((UITextField)view).Font.PointSize);
                }
                else if (view is UITextView)
                {
                    return(((UITextView)view).Font.PointSize);
                }
                return(0.0f);

            default:
                return(0.0f);
            }
        }