示例#1
0
        private void SetupSubViews()
        {
            SelectionStyle = UITableViewCellSelectionStyle.None;

            BackgroundColor = iOS.Appearance.Colors.BackgroundColor;

            _backPanelView = new BackPanelView {
                BackgroundColor = iOS.Appearance.Colors.White
            };

            _logo = new MvxImageView();
            _logo.Layer.CornerRadius = 12.0f;
            _logo.Layer.BorderWidth  = 1;
            _logo.Layer.BorderColor  = iOS.Appearance.Colors.RulerColor.CGColor;
            _logo.ClipsToBounds      = true;

            _name = new UILabel {
                Font = iOS.Appearance.Fonts.LatoBoldWithSize(16), TextColor = iOS.Appearance.Colors.DefaultTextColor
            };

            _industry = new UILabel {
                Font = iOS.Appearance.Fonts.LatoWithSize(13), TextColor = iOS.Appearance.Colors.DefaultTextColor
            };

            _horizontalLine = new UIView {
                BackgroundColor = iOS.Appearance.Colors.RulerColor
            };

            _numberOfCoworkers = new UILabel {
                Font = iOS.Appearance.Fonts.LatoWithSize(12), TextColor = iOS.Appearance.Colors.SubTextColor
            };

            _usersCollection = new UICollectionView(ContentView.Frame, new UICollectionViewFlowLayout {
                ItemSize = new CGSize(20, 20), ScrollDirection = UICollectionViewScrollDirection.Horizontal, MinimumInteritemSpacing = 0, MinimumLineSpacing = 2
            })
            {
                AllowsSelection = true,
                ScrollEnabled   = false,
                BackgroundColor = UIColor.Clear,
            };

            _usersCollection.RegisterClassForCell(typeof(CollectionUserCell), CollectionUserCell.Identifier);
            _usersCollection.Source = _source = new MvxCollectionViewSource(_usersCollection, CollectionUserCell.Identifier);

            ContentView.Add(_backPanelView);
            ContentView.Add(_horizontalLine);
            ContentView.Add(_logo);
            ContentView.Add(_name);
            ContentView.Add(_industry);
            ContentView.Add(_numberOfCoworkers);
            ContentView.Add(_usersCollection);
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                _backPanelView.Dispose();
                _backPanelView = null;
                _horizontalLine.Dispose();
                _horizontalLine = null;
                _verticalLine.Dispose();
                _verticalLine = null;
                _membersButton.Dispose();
                _membersButton = null;
                _eventsButton.Dispose();
                _eventsButton = null;
                _groupsButton.Dispose();
                _groupsButton = null;
                _infoButton.Dispose();
                _infoButton = null;
            }
        }
        private void SetupSubViews()
        {
            // Cell properties
            SelectionStyle  = UITableViewCellSelectionStyle.None;
            BackgroundColor = iOS.Appearance.Colors.BackgroundColor;

            // Subviews
            _backPanelView = new BackPanelView {
                BackgroundColor = iOS.Appearance.Colors.White
            };
            _horizontalLine = new UIView {
                BackgroundColor = iOS.Appearance.Colors.RulerColor
            };
            _verticalLine = new UIView {
                BackgroundColor = iOS.Appearance.Colors.RulerColor
            };

            _membersButton = new UIButton {
                Font = iOS.Appearance.Fonts.LatoBoldWithSize(14)
            };
            _membersButton.SetTitleColor(iOS.Appearance.Colors.DefaultTextColor, UIControlState.Normal);
            using (var memberImage = UIImage.FromBundle("Icons/icon_members.png"))
            {
                _membersButton.SetImage(memberImage, UIControlState.Normal);
            }

            _eventsButton = new UIButton {
                Font = iOS.Appearance.Fonts.LatoBoldWithSize(14)
            };
            _eventsButton.SetTitleColor(iOS.Appearance.Colors.DefaultTextColor, UIControlState.Normal);
            using (var eventsImage = UIImage.FromBundle("Icons/icon_calendar.png"))
            {
                _eventsButton.SetImage(eventsImage, UIControlState.Normal);
            }

            _groupsButton = new UIButton {
                Font = iOS.Appearance.Fonts.LatoBoldWithSize(14)
            };
            _groupsButton.SetTitleColor(iOS.Appearance.Colors.DefaultTextColor, UIControlState.Normal);
            using (var groupImage = UIImage.FromBundle("Icons/icon_groups.png"))
            {
                _groupsButton.SetImage(groupImage, UIControlState.Normal);
            }

            _infoButton = new UIButton {
                Font = iOS.Appearance.Fonts.LatoBoldWithSize(14)
            };
            _infoButton.SetTitleColor(iOS.Appearance.Colors.DefaultTextColor, UIControlState.Normal);
            using (var infoImage = UIImage.FromBundle("Icons/icon_info.png"))
            {
                _infoButton.SetImage(infoImage, UIControlState.Normal);
            }

            ContentView.Add(_backPanelView);
            ContentView.Add(_horizontalLine);
            ContentView.Add(_verticalLine);
            ContentView.Add(_membersButton);
            ContentView.Add(_eventsButton);
            ContentView.Add(_groupsButton);
            ContentView.Add(_infoButton);
        }