Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.dataSource.LoadDataFromJSONResource ("ListViewSampleData", "json", "photos");

            this.dataSource.Settings.ListView.CreateCell ((TKListView listView, NSIndexPath indexPath, NSObject item) => {
                return listView.DequeueReusableCell("cell", indexPath) as TKListViewCell;
            });
            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);
            });

            this.listView.Frame = this.View.Bounds;
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDataSource = this.dataSource;
            this.listView.RegisterClassForCell (new ObjCRuntime.Class (typeof(AnimationListCell)), "cell");
            this.View.AddSubview (this.listView);

            var layout = new TKListViewGridLayout();
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
                layout.SpanCount = 3;
            }
            else {
                layout.SpanCount = 2;
            }
            layout.ItemSize = new CGSize(130, 180);
            layout.ItemSpacing = 10;
            layout.LineSpacing = 10;
            layout.ItemAlignment = TKListViewItemAlignment.Center;
            layout.ItemAppearAnimation = TKListViewItemAnimation.Scale;
            layout.AnimationDuration = 0.4f;
            this.listView.Layout = layout;
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
		}
Ejemplo n.º 6
0
        void GridLayoutSelected(object sender, EventArgs e)
        {
            TKListViewGridLayout layout = new TKListViewGridLayout();

            layout.ItemSize            = new CGSize(200, 100);
            layout.HeaderReferenceSize = new CGSize(100, 30);
            layout.SpanCount           = 2;
            layout.ItemSpacing         = 1;
            layout.LineSpacing         = 1;
            layout.ScrollDirection     = this.scrollDirection;
            this.listView.Layout       = layout;
            this.SetSelectedOptionInSection(1, 1);
        }
Ejemplo n.º 7
0
        public override void ViewDidLoad()
        {
            AddOption("Scale in", ScaleInSelected);
            AddOption("Fade in", FadeInSelected);
            AddOption("Slide in", SlideInSelected);

            base.ViewDidLoad();

            string s = TKChart.VersionString;

            this.dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "photos");

            this.dataSource.Settings.ListView.CreateCell((TKListView listView, NSIndexPath indexPath, NSObject item) => {
                return(listView.DequeueReusableCell("cell", indexPath) as TKListViewCell);
            });
            this.dataSource.Settings.ListView.InitCell(delegate(TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) {
                cell.ImageView.Image = UIImage.FromBundle(this.dataSource.Items[indexPath.Row] as NSString);
            });

            this.listView.Frame            = this.View.Bounds;
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDataSource   = this.dataSource;
            this.listView.RegisterClassForCell(new ObjCRuntime.Class(typeof(AnimationListCell)), "cell");
            this.View.AddSubview(this.listView);

            var layout = new TKListViewGridLayout();

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                layout.SpanCount = 3;
            }
            else
            {
                layout.SpanCount = 2;
            }
            layout.ItemSize    = new CGSize(130, 180);
            layout.ItemSpacing = 10;
            layout.LineSpacing = 10;

            // >> listview-alignment-cs
            layout.ItemAlignment = TKListViewItemAlignment.Center;
            // << listview-alignment-cs

            layout.ItemAppearAnimation = TKListViewItemAnimation.Scale;

            // >> listview-animation-duration-cs
            layout.AnimationDuration = 0.4f;
            // << listview-animation-duration-cs

            this.listView.Layout = layout;
        }
Ejemplo n.º 8
0
        void GridLayoutSelected()
        {
            // >> listview-grid-cs
            TKListViewGridLayout layout = new TKListViewGridLayout();

            layout.ItemSize            = new CGSize(200, 100);
            layout.HeaderReferenceSize = new CGSize(100, 30);
            layout.SpanCount           = 2;
            layout.ItemSpacing         = 1;
            layout.LineSpacing         = 1;
            layout.ScrollDirection     = this.scrollDirection;
            this.listView.Layout       = layout;
            // << listview-grid-cs
            this.SetSelectedOption(1, 1);
        }
Ejemplo n.º 9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.View.BackgroundColor = UIColor.FromRGB(239, 239, 244);

            this.Autocomplete = new TKAutoCompleteTextView(new CGRect(10, this.View.Bounds.Y + 10, this.View.Bounds.Size.Width - 10, 30));
            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.RegisterClassForCell(new Class(typeof(PersonListViewCell)), "cell");

            TKListViewGridLayout layout = new TKListViewGridLayout();

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

            // >> autocmp-display-mode-cs
            this.Autocomplete.DisplayMode = TKAutoCompleteDisplayMode.Tokens;
            // << autocmp-display-mode-cs

            // >> autocmp-layout-mode-cs
            this.Autocomplete.LayoutMode = TKAutoCompleteLayoutMode.Wrap;
            // << autocmp-layout-mode-cs
            this.Autocomplete.AutoresizingMask          = UIViewAutoresizing.FlexibleWidth;
            this.Autocomplete.MaximumWrapHeight         = 150;
            this.Autocomplete.WeakDataSource            = this.Datasource;
            this.Autocomplete.TextField.Placeholder     = "Enter Users";
            this.Autocomplete.NoResultsLabel.Text       = "No Users Found";
            this.Autocomplete.ImageView.Image           = UIImage.FromBundle(new NSString("search.png"));
            this.Autocomplete.MinimumCharactersToSearch = 1;
            this.Autocomplete.WeakDelegate         = autocompleteDelegate;
            this.Autocomplete.SuggestionViewHeight = this.View.Bounds.Height - this.View.Bounds.Y + 45;
            this.View.AddSubview(this.Autocomplete);
        }
Ejemplo n.º 10
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			this.View.BackgroundColor = UIColor.FromRGB (239, 239, 244);

			this.Autocomplete = new TKAutoCompleteTextView(new CGRect(10, this.View.Bounds.Y + 10, this.View.Bounds.Size.Width - 10, 30));
			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.RegisterClassForCell (new Class(typeof(PersonListViewCell)), "cell");

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

			this.Autocomplete.DisplayMode = TKAutoCompleteDisplayMode.Tokens;
			this.Autocomplete.LayoutMode = TKAutoCompleteLayoutMode.Wrap;
			this.Autocomplete.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			this.Autocomplete.MaximumWrapHeight = 150;
			this.Autocomplete.WeakDataSource = this.Datasource;
			this.Autocomplete.TextField.Placeholder = "Enter Users";
			this.Autocomplete.NoResultsLabel.Text = "No Users Found";
			this.Autocomplete.ImageView.Image = UIImage.FromBundle (new NSString("search.png"));
			this.Autocomplete.MinimumCharactersToSearch = 1;
			this.Autocomplete.WeakDelegate = autocompleteDelegate;
			this.Autocomplete.SuggestionViewHeight = this.View.Bounds.Height - this.View.Bounds.Y + 45;
			this.View.AddSubview (this.Autocomplete);
		}
Ejemplo n.º 11
0
 void GridLayoutSelected()
 {
     TKListViewGridLayout layout = new TKListViewGridLayout ();
     layout.ItemSize = new CGSize(200, 100);
     layout.HeaderReferenceSize = new CGSize(100, 30);
     layout.SpanCount = 2;
     layout.ItemSpacing = 1;
     layout.LineSpacing = 1;
     layout.ScrollDirection = this.scrollDirection;
     this.listView.Layout = layout;
     this.SetSelectedOption (1, 1);
 }