public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "photos");
            this.dataSource.Settings.ListView.InitCell(delegate(TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) {
                cell.ImageView.Image = new UIImage(this.dataSource.Items[indexPath.Row] as NSString);
                TKView view          = cell.BackgroundView as TKView;
                view.Stroke.Width    = 0;

                cell.ImageView.Layer.ShadowColor   = new UIColor(0.27f, 0.27f, 0.55f, 1.0f).CGColor;
                cell.ImageView.Layer.ShadowOffset  = new CGSize(2, 2);
                cell.ImageView.Layer.ShadowOpacity = 0.5f;
                cell.ImageView.Layer.ShadowRadius  = 3;
            });

            this.listView.Frame              = this.View.Bounds;
            this.listView.AutoresizingMask   = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDataSource     = this.dataSource;
            this.listView.CellAppearBehavior = new TKListViewCellScaleInBehavior();
            this.View.AddSubview(this.listView);

            TKListViewColumnsLayout layout = (TKListViewColumnsLayout)this.listView.Layout;

            layout.ItemSize           = new CGSize(130, 180);
            layout.MinimumLineSpacing = 10;
            layout.CellAlignment      = TKListViewCellAlignment.Stretch;
        }
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.Photos = new TKDataSource ("PhotosWithNames", "json", "photos");
            this.Names = new TKDataSource ("PhotosWithNames", "json", "names");

            TKListView listView = new TKListView (this.View.Bounds);
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            listView.DataSource = new ListViewDataSource (this);
            this.View.AddSubview (listView);
            listView.RegisterClassForCell (new Class(typeof(ImageWithTextListViewCell)), "cell");

            TKListViewGridLayout layout = new TKListViewGridLayout();
            layout.ItemAlignment = TKListViewItemAlignment.Center;
            layout.SpanCount = 2;
            layout.ItemSize = new CGSize (150, 200);
            layout.LineSpacing = 60;
            layout.ItemSpacing = 10;
            listView.Layout = layout;

            TKView view = new TKView ();
            view.Fill = TKLinearGradientFill.WithColors (new UIColor[] {
                new UIColor (0.35f, 0.68f, 0.89f, 0.89f),
                new UIColor (0.35f, 0.68f, 1.0f, 1.0f),
                new UIColor (0.85f, 0.8f, 0.2f, 0.8f)
            });
            listView.BackgroundView = view;
        }
예제 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.Photos = new TKDataSource("PhotosWithNames", "json", "photos");
            this.Names  = new TKDataSource("PhotosWithNames", "json", "names");

            this.listViewDataSource = new ListViewDataSource(this);

            TKListView listView = new TKListView(this.View.Bounds);

            listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            listView.DataSource       = this.listViewDataSource;
            this.View.AddSubview(listView);
            listView.RegisterClassForCell(new Class(typeof(ImageWithTextListViewCell)), "cell");

            TKListViewGridLayout layout = new TKListViewGridLayout();

            layout.ItemAlignment = TKListViewItemAlignment.Center;
            layout.SpanCount     = 2;
            layout.ItemSize      = new CGSize(150, 200);
            layout.LineSpacing   = 60;
            layout.ItemSpacing   = 10;
            listView.Layout      = layout;

            TKView view = new TKView();

            view.Fill = TKLinearGradientFill.WithColors(new UIColor[] {
                new UIColor(0.35f, 0.68f, 0.89f, 0.89f),
                new UIColor(0.35f, 0.68f, 1.0f, 1.0f),
                new UIColor(0.85f, 0.8f, 0.2f, 0.8f)
            });
            listView.BackgroundView = view;
        }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // >> gauge-customize-cs
            this.colors = new UIColor[] {
                new UIColor(0.00f, 0.70f, 0.90f, 1.00f),
                new UIColor(0.38f, 0.73f, 0.00f, 1.00f),
                new UIColor(0.96f, 0.56f, 0.00f, 1.00f),
                new UIColor(0.00f, 1.00f, 1.00f, 1.00f),
                new UIColor(0.77f, 1.00f, 0.00f, 1.00f),
                new UIColor(1.00f, 0.85f, 0.00f, 1.00f)
            };
            // << gauge-customize-cs
            string[] legendStrings = new string[] { "MOVE", "EXCERCISE", "STAND" };

            for (int i = 0; i < 3; i++)
            {
                TKView view = new TKView(new CGRect(20, 40 + i * 25, 22, 22));
                view.Fill  = new TKLinearGradientFill(new UIColor[] { this.colors[i], this.colors[i + 3] }, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
                view.Shape = new TKPredefinedShape(TKShapeType.Circle, new CGSize(0, 0));
                this.View.AddSubview(view);

                UILabel label = new UILabel(new CGRect(50, 40 + i * 25, this.View.Frame.GetMaxX() - 60, 20));
                label.Text = legendStrings[i];
                label.Font.WithSize(15);
                label.TextColor = new UIColor(0.2f, 0.2f, 0.2f, 1f);
                this.View.AddSubview(label);
            }

            this.CreateLinearGauge();
            this.CreateRadialGauge();
        }
예제 #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.Photos = new TKDataSource("PhotosWithNames", "json", "photos");
            this.Names  = new TKDataSource("PhotosWithNames", "json", "names");

            this.Photos.Settings.ListView.CreateCell(delegate(TKListView listView, NSIndexPath indexPath, NSObject item) {
                TKListViewCell cell = listView.DequeueReusableCell("simpleCell", indexPath) as TKListViewCell;
                return(cell);
            });

            this.Photos.Settings.ListView.InitCell(delegate(TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) {
                NSString imageName      = (NSString)this.Photos.Items [indexPath.Row];
                cell.ImageView.Image    = new UIImage(imageName);
                cell.TextLabel.Text     = this.Names.Items [indexPath.Row] as NSString;
                TKView view             = (TKView)cell.BackgroundView;
                view.Stroke.StrokeSides = listView.Layout.IsKindOfClass(new Class(typeof(TKListViewColumnsLayout))) ? TKRectSide.Right | TKRectSide.Bottom : TKRectSide.All;
                view.SetNeedsDisplay();
            });

            this.ListView = new TKListView(this.View.Bounds);
            this.ListView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.ListView.WeakDataSource   = this.Photos;
            this.ListView.RegisterClassForCell(new Class(typeof(SimpleListViewCell)), "simpleCell");
            this.View.AddSubview(this.ListView);

            this.WrapLayoutSelected(this, EventArgs.Empty);
        }
예제 #6
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			this.colors = new UIColor[] { 
				new UIColor (0.00f, 0.70f, 0.90f ,1.00f),
				new UIColor (0.38f, 0.73f, 0.00f, 1.00f),
				new UIColor (0.96f, 0.56f, 0.00f, 1.00f),
				new UIColor (0.00f, 1.00f, 1.00f, 1.00f),
				new UIColor (0.77f, 1.00f, 0.00f, 1.00f),
				new UIColor (1.00f, 0.85f, 0.00f, 1.00f)
			};

			string[] legendStrings = new string[] { "MOVE", "EXCERCISE", "STAND" };

			for (int i = 0; i < 3; i++) {
				TKView view = new TKView (new CGRect (20, 40 + i * 25, 22, 22));
				view.Fill = new TKLinearGradientFill(new UIColor[] {this.colors[i], this.colors[i+3]}, new CGPoint(0.0f, 0.0f), new CGPoint(1.0f, 1.0f));
				view.Shape = new TKPredefinedShape (TKShapeType.Circle, new CGSize (0, 0));
				this.View.AddSubview (view);

				UILabel label = new UILabel( new CGRect(50, 40 + i * 25, this.View.Frame.GetMaxX() - 60, 20));
				label.Text = legendStrings[i];
				label.Font.WithSize (15);
				label.TextColor = new UIColor(0.2f, 0.2f, 0.2f, 1f);
				this.View.AddSubview(label);

			}

			this.CreateLinearGauge ();
			this.CreateRadialGauge ();
		}
예제 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.View.BackgroundColor = UIColor.FromRGB(239, 239, 244);
            TKView view = new TKView(this.View.Bounds);

            view.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            view.Fill             = TKLinearGradientFill.WithColors(new UIColor[] {
                new UIColor(0.35f, 0.68f, 0.89f, 0.89f),
                new UIColor(0.35f, 0.68f, 1.0f, 1.0f),
                new UIColor(0.85f, 0.8f, 0.2f, 0.8f)
            });
            this.View.AddSubview(view);

            this.Autocomplete = new TKAutoCompleteTextView(new CGRect(10, this.View.Bounds.Y + 10, this.View.Bounds.Size.Width - 20, 35));
            this.Autocomplete.SuggestionViewOutOfFrame = true;
            this.AutomaticallyAdjustsScrollViewInsets  = false;

            this.Datasource = new TKDataSource();
            this.Datasource.LoadDataFromJSONResource("namesPhotos", "json", "data");
            this.Datasource.Settings.AutoComplete.CreateToken(delegate(nuint index, NSObject item) {
                TKAutoCompleteToken token = new TKAutoCompleteToken((NSString)(item.ValueForKey(new NSString("name"))));
                token.Image = UIImage.FromBundle((NSString)item.ValueForKey(new NSString("photo")));
                return(token);
            });

            TKListView listView = (TKListView)this.Autocomplete.WeakSuggestionView;

            listView.BackgroundColor = UIColor.Clear;
            listView.Frame           = new CGRect(10, this.View.Bounds.Y + 15 + this.Autocomplete.Bounds.Height, this.View.Bounds.Size.Width - 20, this.View.Bounds.Height - (15 + this.Autocomplete.Bounds.Height));
            listView.RemoveFromSuperview();
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview(listView);
            listView.RegisterClassForCell(new Class(typeof(ImageWithTextListViewCell)), "cell");

            TKListViewGridLayout layout = new TKListViewGridLayout();

            layout.ItemAlignment = TKListViewItemAlignment.Center;
            layout.SpanCount     = 2;
            layout.ItemSize      = new CGSize(150, 200);
            layout.LineSpacing   = 60;
            layout.ItemSpacing   = 10;
            listView.Layout      = layout;

            this.Autocomplete.SuggestMode           = TKAutoCompleteSuggestMode.SuggestAppend;
            this.Autocomplete.AutoresizingMask      = UIViewAutoresizing.FlexibleWidth;
            this.Autocomplete.MaximumWrapHeight     = 80;
            this.Autocomplete.WeakDataSource        = this.Datasource;
            this.Autocomplete.TextField.Placeholder = "Enter Users";
            this.Autocomplete.NoResultsLabel.Text   = "No Users Found";
            this.Autocomplete.CloseButton.SetImage(UIImage.FromBundle("clear.png"), UIControlState.Normal);
            this.Autocomplete.ImageView.Image       = UIImage.FromBundle(new NSString("search.png"));
            this.Autocomplete.BackgroundColor       = UIColor.White;
            this.Autocomplete.WeakDelegate          = autocompleteDelegate;
            this.Autocomplete.ShowAllItemsInitially = true;
            this.View.AddSubview(this.Autocomplete);
        }
예제 #8
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			this.View.BackgroundColor = UIColor.FromRGB (239, 239, 244);
			TKView view = new TKView (this.View.Bounds);
			view.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			view.Fill = TKLinearGradientFill.WithColors (new UIColor[] { 
				new UIColor (0.35f, 0.68f, 0.89f, 0.89f), 
				new UIColor (0.35f, 0.68f, 1.0f, 1.0f), 
				new UIColor (0.85f, 0.8f, 0.2f, 0.8f)
			});
			this.View.AddSubview (view);

			this.Autocomplete = new TKAutoCompleteTextView (new CGRect (10, this.View.Bounds.Y + 10, this.View.Bounds.Size.Width-20, 35));
			this.Autocomplete.SuggestionViewOutOfFrame = true;
			this.AutomaticallyAdjustsScrollViewInsets = false;

			this.Datasource = new TKDataSource ();
			this.Datasource.LoadDataFromJSONResource ("namesPhotos", "json", "data");
			this.Datasource.Settings.AutoComplete.CreateToken (delegate(nuint index, NSObject item) {
				TKAutoCompleteToken token = new TKAutoCompleteToken ((NSString)(item.ValueForKey (new NSString ("name"))));
				token.Image = UIImage.FromBundle ((NSString)item.ValueForKey (new NSString ("photo")));
				return token;
			});

			TKListView listView = (TKListView)this.Autocomplete.WeakSuggestionView;
			listView.BackgroundColor = UIColor.Clear;
			listView.Frame = new CGRect (10, this.View.Bounds.Y + 15 + this.Autocomplete.Bounds.Height, this.View.Bounds.Size.Width-20, this.View.Bounds.Height - (15 + this.Autocomplete.Bounds.Height));
			listView.RemoveFromSuperview ();
			listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			this.View.AddSubview (listView);
			listView.RegisterClassForCell (new Class (typeof(ImageWithTextListViewCell)), "cell");

			TKListViewGridLayout layout = new TKListViewGridLayout ();
			layout.ItemAlignment = TKListViewItemAlignment.Center;
			layout.SpanCount = 2;
			layout.ItemSize = new CGSize (150, 200);
			layout.LineSpacing = 60;
			layout.ItemSpacing = 10;
			listView.Layout = layout;

			this.Autocomplete.SuggestMode = TKAutoCompleteSuggestMode.SuggestAppend;
			this.Autocomplete.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			this.Autocomplete.MaximumWrapHeight = 80;
			this.Autocomplete.WeakDataSource = this.Datasource;
			this.Autocomplete.TextField.Placeholder = "Enter Users";
			this.Autocomplete.NoResultsLabel.Text = "No Users Found";
			this.Autocomplete.CloseButton.SetImage (UIImage.FromBundle ("clear.png"), UIControlState.Normal);
			this.Autocomplete.ImageView.Image = UIImage.FromBundle (new NSString ("search.png"));
			this.Autocomplete.BackgroundColor = UIColor.White;
			this.Autocomplete.WeakDelegate = autocompleteDelegate;
			this.Autocomplete.ShowAllItemsInitially = true;
			this.View.AddSubview (this.Autocomplete);
		}
예제 #9
0
        public override void DidShow(TKAlert alert)
        {
            TKView view = new TKView ();
            view.Frame = new CGRect (20, -30, 60, 60);
            view.Shape = new TKPredefinedShape (TKShapeType.Circle, new CGSize (0, 0));
            view.Fill = new TKSolidFill(new UIColor(0.961f, 0.369f, 0.306f, 1f));
            view.Stroke = new TKStroke (new UIColor (1f, 1f, 1f, 1f), 3.0f);
            view.Transform = CGAffineTransform.MakeScale (0.1f, 0.1f);
            alert.AlertView.AddSubview (view);

            UIView.AnimateNotify (0.7f, 0.0f, 0.3f, 0.2f, UIViewAnimationOptions.CurveEaseInOut, () => {
                view.Transform = CGAffineTransform.MakeScale(1f, 1f);
            }, (bool finished) => {
            });
        }
예제 #10
0
        public override void DidShow(TKAlert alert)
        {
            TKView view = new TKView();

            view.Frame     = new CGRect(20, -30, 60, 60);
            view.Shape     = new TKPredefinedShape(TKShapeType.Circle, new CGSize(0, 0));
            view.Fill      = new TKSolidFill(new UIColor(0.961f, 0.369f, 0.306f, 1f));
            view.Stroke    = new TKStroke(new UIColor(1f, 1f, 1f, 1f), 3.0f);
            view.Transform = CGAffineTransform.MakeScale(0.1f, 0.1f);
            alert.AlertView.AddSubview(view);

            UIView.AnimateNotify(0.7f, 0.0f, 0.3f, 0.2f, UIViewAnimationOptions.CurveEaseInOut, () => {
                view.Transform = CGAffineTransform.MakeScale(1f, 1f);
            }, (bool finished) => {
            });
        }
예제 #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.redColors = new UIColor[] { new UIColor(0.96f, 0.80f, 0.80f, 1.0f),
                                             new UIColor(0.80f, 0.00f, 0.00f, 1.0f),
                                             new UIColor(0.88f, 0.40f, 0.40f, 1.0f) };

            this.greenColors = new UIColor[] { new UIColor(0.85f, 0.92f, 0.83f, 1.0f),
                                               new UIColor(0.71f, 0.84f, 0.66f, 1.0f),
                                               new UIColor(0.58f, 0.77f, 0.49f, 1.0f) };

            this.blueColors = new UIColor[] { new UIColor(0.62f, 0.77f, 0.91f, 1.0f),
                                              new UIColor(0.44f, 0.66f, 0.86f, 1.0f),
                                              new UIColor(0.11f, 0.27f, 0.53f, 1.0f) };

            this.redValues   = new NSNumber[] { new NSNumber(0), new NSNumber(20), new NSNumber(40), new NSNumber(100) };
            this.greenValues = new NSNumber[] { new NSNumber(0), new NSNumber(40), new NSNumber(80), new NSNumber(100) };
            this.blueValues  = new NSNumber[] { new NSNumber(0), new NSNumber(10), new NSNumber(90), new NSNumber(100) };

            string[]  legendStrings = new string[] { "FATS", "CARBS", "PROTEINS" };
            UIColor[] legendColors  = new UIColor[] { new UIColor(0.96f, 0.80f, 0.80f, 1.0f),
                                                      new UIColor(0.85f, 0.92f, 0.83f, 1.0f),
                                                      new UIColor(0.62f, 0.77f, 0.91f, 1.0f) };

            for (int i = 0; i < 3; i++)
            {
                TKView view = new TKView(new CGRect(20, 40 + i * 25, 22, 22));
                view.Fill  = new TKSolidFill(legendColors[i]);
                view.Shape = new TKPredefinedShape(TKShapeType.Circle, new CGSize(0, 0));
                this.View.AddSubview(view);

                UILabel label = new UILabel(new CGRect(50, 40 + i * 25, this.View.Frame.GetMaxX() - 60, 20));
                label.Text      = legendStrings[i];
                label.Font      = UIFont.SystemFontOfSize(15);
                label.TextColor = new UIColor(0.2f, 0.2f, 0.2f, 1);
                this.View.AddSubview(label);
            }

            this.CreateLinearGauge();
            this.CreateRadialGauge();
        }
예제 #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.redColors =  new UIColor[] { new UIColor(0.96f, 0.80f, 0.80f, 1.0f),
                new UIColor(0.80f, 0.00f, 0.00f, 1.0f),
                new UIColor(0.88f, 0.40f, 0.40f, 1.0f)};

            this.greenColors = new UIColor[] { new UIColor(0.85f, 0.92f, 0.83f, 1.0f),
                new UIColor(0.71f, 0.84f, 0.66f, 1.0f),
                new UIColor(0.58f, 0.77f, 0.49f, 1.0f) };

            this.blueColors  = new UIColor[] { new UIColor(0.62f, 0.77f, 0.91f, 1.0f) ,
                new UIColor(0.44f, 0.66f, 0.86f, 1.0f),
                new UIColor(0.11f, 0.27f, 0.53f, 1.0f)};

            this.redValues = new NSNumber[] {new NSNumber(0), new NSNumber(20), new NSNumber(40), new NSNumber(100) };
            this.greenValues = new NSNumber[] {new NSNumber(0),new NSNumber(40), new NSNumber(80), new NSNumber(100) };
            this.blueValues = new NSNumber[] { new NSNumber(0), new NSNumber(10), new NSNumber(90), new NSNumber(100) };

            string[] legendStrings = new string[]{"FATS", "CARBS", "PROTEINS"};
            UIColor[] legendColors = new UIColor[] {new UIColor(0.96f, 0.80f, 0.80f, 1.0f),
                new UIColor(0.85f, 0.92f, 0.83f, 1.0f),
                new UIColor(0.62f, 0.77f, 0.91f, 1.0f)};

            for (int i=0; i < 3; i++) {
                TKView view = new TKView(new CGRect(20, 40 + i*25, 22, 22));
                view.Fill = new TKSolidFill(legendColors[i]);
                view.Shape = new TKPredefinedShape(TKShapeType.Circle, new CGSize(0, 0));
                this.View.AddSubview(view);

                UILabel label = new UILabel(new CGRect(50, 40 + i * 25, this.View.Frame.GetMaxX() - 60, 20));
                label.Text = legendStrings[i];
                label.Font = UIFont.SystemFontOfSize(15);
                label.TextColor = new UIColor(0.2f, 0.2f, 0.2f, 1);
                this.View.AddSubview(label);
            }

            this.CreateLinearGauge ();
            this.CreateRadialGauge ();
        }