示例#1
0
 static void SetTransform(this EdgeObjectState state, UIView view)
 {
     switch (state.Property)
     {
     case EdgePropertyType.RotateZ:
         view.Transform = CGAffineTransform.MakeRotation(GetRotation(state.Value));
         return;
     }
 }
示例#2
0
        static void SetStyle(this EdgeObjectState state, UIView view)
        {
            switch (state.Property)
            {
            case EdgePropertyType.Opacity:
                view.Alpha = float.Parse(state.Value);
                return;

                ;

            case EdgePropertyType.Left:
            {
                var frame = view.Frame;
                frame.X    = StageParser.ParseFloat(state.Value);
                view.Frame = frame;
            }
                return;

            case EdgePropertyType.Top:
            {
                var frame = view.Frame;
                frame.Y    = StageParser.ParseFloat(state.Value);
                view.Frame = frame;
            }
                return;

            case EdgePropertyType.Width:
            {
                var frame = view.Frame;
                frame.Width = StageParser.ParseFloat(state.Value);
                view.Frame  = frame;
            }
                return;

            case EdgePropertyType.Height:
            {
                var frame = view.Frame;
                frame.Height = StageParser.ParseFloat(state.Value);
                view.Frame   = frame;
            }
                return;

            case EdgePropertyType.Display:
                view.Hidden = state.Value == "none";
                return;
            }
        }
示例#3
0
        static void SetColor(this EdgeObjectState state, UIView view)
        {
            var values = state.Value.Replace("rgba(", "").Replace(")", "").Split(',');
            var color  = UIColor.FromRGBA(
                int.Parse(values [0]),
                int.Parse(values [1]),
                int.Parse(values [2]),
                int.Parse(values [3]) * 255
                );

            if (view is UILabel)
            {
                var lbl = view as UILabel;
                lbl.TextColor = color;
                return;
            }
            view.BackgroundColor = color;
        }
示例#4
0
        public static void SetState(this EdgeObjectState state, string id, Stage Stage)
        {
            var childView = Stage.NaviveViews [id] as UIView;

            if (childView == null)
            {
                return;
            }
            switch (state.PropertyType)
            {
            case EdgeObjectStateType.Color:
                state.SetColor(childView);
                break;

            case EdgeObjectStateType.Transform:
                state.SetTransform(childView);
                break;

            case EdgeObjectStateType.Style:
                state.SetStyle(childView);
                break;
            }
        }