コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            dataSource.LoadDataFromJSONResource("ListViewSampleData", "json", "teams");
            dataSource.GroupItemSourceKey = "items";
            dataSource.FilterWithQuery("key like 'Marketing'");
            dataSource.GroupWithKey("key");

            this.UpdateData(3);

            this.listViewDataSource = new ListViewDataSource(this);
            this.listViewDelegate   = new ListViewDelegate(this);

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

            listView.RegisterClassForCell(new ObjCRuntime.Class(typeof(TKListViewCell)), "cell");
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            listView.DataSource       = this.listViewDataSource;
            listView.Delegate         = this.listViewDelegate;

            // >> listview-pull-to-refresh-cs
            listView.AllowsPullToRefresh = true;
            // << listview-pull-to-refresh-cs

            listView.PullToRefreshTreshold                     = 70;
            listView.PullToRefreshView.BackgroundColor         = UIColor.Blue;
            listView.PullToRefreshView.ActivityIndicator.Color = UIColor.White;
            this.View.AddSubview(listView);
        }
コード例 #2
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;
        }
コード例 #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;
        }
コード例 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.sampleArrayOfStrings = NSArray.FromStrings(new String [] {
                "Kristina Wolfe",
                "Freda Curtis",
                "Jeffery Francis",
                "Eva Lawson",
                "Emmett Santos",
                "Theresa Bryan",
                "Jenny Fuller",
                "Terrell Norris",
                "Eric Wheeler",
                "Julius Clayton",
                "Alfredo Thornton",
                "Roberto Romero",
                "Orlando Mathis",
                "Eduardo Thomas",
                "Harry Douglas"
            });

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

            listView.RegisterClassForCell(new Class(typeof(TKListViewCell)), "cell");
            listView.DataSource = new ListViewDataSource(this);

            this.View.AddSubview(listView);
        }
コード例 #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            dataSource.LoadDataFromJSONResource ("ListViewSampleData", "json", "teams");
            dataSource.GroupItemSourceKey = "items";
            dataSource.FilterWithQuery ("key like 'Marketing'");
            dataSource.GroupWithKey ("key");

            this.UpdateData (3);

            this.listViewDataSource =  new ListViewDataSource (this);
            this.listViewDelegate = new ListViewDelegate (this);

            TKListView listView = new TKListView (this.View.Bounds);
            listView.RegisterClassForCell (new ObjCRuntime.Class (typeof(TKListViewCell)), "cell");
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            listView.DataSource = this.listViewDataSource;
            listView.Delegate = this.listViewDelegate;
            listView.AllowsPullToRefresh = true;
            listView.PullToRefreshTreshold = 70;
            listView.PullToRefreshView.BackgroundColor = UIColor.Blue;
            listView.PullToRefreshView.ActivityIndicator.Color = UIColor.White;
            this.View.AddSubview (listView);
        }
コード例 #6
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);
        }
コード例 #7
0
        void CreateListView()
        {
            var list = new TKListView (this.View.Bounds);
            list.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            list.RegisterClassForCell (new ObjCRuntime.Class(typeof(ListViewVariableSizeCell)), "cell");
            this.View.AddSubview (list);

            TKListViewLinearLayout layout = (TKListViewLinearLayout)list.Layout;
            layout.DynamicItemSize = true;

            list.WeakDataSource = new ListViewDataSource();
        }
コード例 #8
0
        void CreateListView()
        {
            var list = new TKListView(this.View.Bounds);

            list.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            list.RegisterClassForCell(new ObjCRuntime.Class(typeof(ListViewVariableSizeCell)), "cell");
            this.View.AddSubview(list);

            TKListViewLinearLayout layout = (TKListViewLinearLayout)list.Layout;

            layout.DynamicItemSize = true;

            list.WeakDataSource = new ListViewDataSource();
        }
コード例 #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);
        }
コード例 #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            groups = new NSMutableArray();
            groups.Add(NSArray.FromStrings(new string[] { "John", "Abby" }));
            groups.Add(NSArray.FromStrings(new string[] { "Smith", "Peter", "Paula" }));

            TKListView listView = new TKListView(new CGRect(20, 20, this.View.Bounds.Size.Width - 40, this.View.Bounds.Size.Height - 40));

            listView.RegisterClassForCell(new Class(typeof(TKListViewCell)), "cell");

            listView.RegisterClassForSupplementaryView(new Class(typeof(TKListViewHeaderCell)), TKListViewElementKindSectionKey.Header, new NSString("header"));
            listView.DataSource = new ListViewDataSource(this);
            TKListViewLinearLayout layout = (TKListViewLinearLayout)listView.Layout;

            layout.HeaderReferenceSize = new CGSize(200, 22);

            this.View.AddSubview(listView);
        }
コード例 #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.photos.LoadDataFromJSONResource("PhotosWithNames", "json", "photos");
            this.names.LoadDataFromJSONResource("PhotosWithNames", "json", "names");

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

            listView.BackgroundColor  = new UIColor(0.0f, 1.0f, 0.0f, 0.5f);
            listView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            listView.Delegate         = new ListViewDelegate(this);
            listView.DataSource       = new ListViewDataSource(this);
            listView.CellBufferSize   = 5;
            listView.Insets           = new UIEdgeInsets(10, 10, 10, 10);
            this.View.AddSubview(listView);
            listView.RegisterClassForCell(new ObjCRuntime.Class(typeof(CustomCardListViewCell)), "cell");

            TKListViewColumnsLayout layout = (TKListViewColumnsLayout)listView.Layout;

            layout.ItemSize           = new CGSize(100, 120);
            layout.MinimumLineSpacing = 5;
            layout.CellAlignment      = TKListViewCellAlignment.Stretch;
        }