Esempio n. 1
0
        protected AlbumTableViewCell(IntPtr handle) : base(handle)
        {
            _lastImage               = new UIImageView();
            _lastImage.ContentMode   = UIViewContentMode.ScaleAspectFill;
            _lastImage.ClipsToBounds = true;
            ContentView.AddSubview(_lastImage);
            _lastImage.AutoSetDimensionsToSize(new CGSize(80, 80));
            _lastImage.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 10);
            _lastImage.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);

            var container = new UIStackView();

            container.Axis = UILayoutConstraintAxis.Vertical;
            ContentView.AddSubview(container);
            container.AutoAlignAxis(ALAxis.Horizontal, _lastImage);
            container.AutoPinEdge(ALEdge.Left, ALEdge.Right, _lastImage, 10);
            container.AutoPinEdgeToSuperviewEdge(ALEdge.Right);

            _name      = new UILabel();
            _name.Font = Constants.Regular16;
            container.AddArrangedSubview(_name);

            _count      = new UILabel();
            _count.Font = Constants.Regular14;
            container.AddArrangedSubview(_count);

            var tapGesture = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Tap, _currentAlbum);
            });

            ContentView.AddGestureRecognizer(tapGesture);
            ContentView.UserInteractionEnabled = true;
        }