Пример #1
0
        public PresenterPostHeader(IViewPostHeader view, IInteractorPostHeader interactor, IRouterPostHeader router, IPost postLocaleStrings, IPostHeaderStylesHolder styleHolder)
        {
            if (view == null || interactor == null || router == null)
            {
                throw new ArgumentNullException();
            }

            _styleHolder          = styleHolder;
            _view                 = view;
            _interactor           = interactor;
            _router               = router;
            _view.Presenter       = this;
            _interactor.Presenter = this;
            _postLocaleStrings    = postLocaleStrings;

            _view.SetConfig();
        }
Пример #2
0
        private void CreateHeader(UIView header, int height)
        {
            _headerView = header as IViewPostHeader;
            (_headerView as UIView).TranslatesAutoresizingMaskIntoConstraints = false;

            _postHeaderContainer.AddSubview(_headerView as UIView);

            //var heightHeader = NSLayoutConstraint.Create(_headerView as UIView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, height);
            HeightContainer = NSLayoutConstraint.Create(_postHeaderContainer, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, height);
            var Width  = NSLayoutConstraint.Create(_postHeaderContainer, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1, _postHeaderContainer.Frame.Width);
            var top    = NSLayoutConstraint.Create(_headerView as UIView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _postHeaderContainer, NSLayoutAttribute.Top, 1, 0);
            var bottom = NSLayoutConstraint.Create(_headerView as UIView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _postHeaderContainer, NSLayoutAttribute.Bottom, 1, 0);
            var left   = NSLayoutConstraint.Create(_headerView as UIView, NSLayoutAttribute.Left, NSLayoutRelation.Equal, _postHeaderContainer, NSLayoutAttribute.Left, 1, 0);
            var right  = NSLayoutConstraint.Create(_headerView as UIView, NSLayoutAttribute.Right, NSLayoutRelation.Equal, _postHeaderContainer, NSLayoutAttribute.Right, 1, 0);

            InvokeOnMainThread(() =>
            {
                NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { top, bottom, left, right, HeightContainer, Width /*, heightHeader*/ });
                LayoutIfNeeded();
            });
        }