久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

UIScrollView 中的自動布局使用 Cirrious.FluentLayouts.

Autolayouts in UIScrollView using Cirrious.FluentLayouts.Touch(UIScrollView 中的自動布局使用 Cirrious.FluentLayouts.Touch)
本文介紹了UIScrollView 中的自動布局使用 Cirrious.FluentLayouts.Touch的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我必須在 scrollView 中使用自動布局做一個 ViewController,但這里有幾個問題:

I've to do a ViewController with autolayouts in scrollView, but here is few problems:

public SomeVC() : UIViewController
    {
        _mainScrollView = new UIScrollView {
            ShowsHorizontalScrollIndicator = false,
            ShowsVerticalScrollIndicator = true,
            BackgroundColor = UIColor.Clear,
            ScrollEnabled = true,
            AutoresizingMask = UIViewAutoresizing.FlexibleHeight,
            TranslatesAutoresizingMaskIntoConstraints = true
        };

        _userDataTableView = new UITableView(CGRect.Empty, UITableViewStyle.Grouped);
        _userDataTableView.LayoutIfNeeded();

        _saveButton = new UIButton();

        _menuTableView = new UITableView(CGRect.Empty, UITableViewStyle.Grouped);
        _menuTableView.LayoutIfNeeded();

        _logoutButton = new UIButton();
    }

    public override void LoadView()
    {
        base.LoadView();
        View = _mainScrollView;
    }

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        Add(_userDataTableView);
        Add(_saveButton);
        Add(_menuTableView);
        Add(_logoutButton);

        _mainScrollView.AddConstraints(
            _userDataTableView.AtTopOf(View),
            _userDataTableView.AtLeftOf(View),
            _userDataTableView.AtRightOf(View),
            _userDataTableView.Height().EqualTo(_userDataTableView.ContentSize.Height),

            _saveButton.Below(_userDataTableView, 20),
            _saveButton.AtLeftOf(_mainScrollView, 10),
            _saveButton.AtRightOf(_mainScrollView, 10),
            _saveButton.Height().EqualTo(44),

            _menuTableView.Below(_saveButton, 20),
            _menuTableView.AtLeftOf(_mainScrollView),
            _menuTableView.AtRightOf(_mainScrollView),
            _menuTableView.Height().EqualTo(_menuTableView.ContentSize.Height),

            _logoutButton.Below(_menuTableView, 20),
            _logoutButton.AtLeftOf(_mainScrollView, 10),
            _logoutButton.AtRightOf(_mainScrollView, 10),
            _logoutButton.Height().EqualTo(44)
        );
        _mainScrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
    }

事實上,它可以工作,但是內容寬度大約是屏幕寬度的一半,并且滾動不起作用.如何讓它工作?

In fact, it works, but contents width is about half of screen width, and scrolling not working. How to get it works?

據我了解,問題是 - _mainScrollView.ContentSize,但是在使用自動布局時我應該如何以及在哪里設置它?

As far as I understand, the problem is - _mainScrollView.ContentSize, but how and where should I set it, when using autolayouts?

推薦答案

找到的解決方案:首先:

Solution found: Firstly:

        _userDataTableView.AtLeftOf(View),
        _userDataTableView.AtRightOf(View),

無效,我們應該使用:

        _userDataTableView.AtLeftOf(View),
        _userDataTableView.WithSameWidth(View),

如果我們想要邊距,我們只需添加

if we want margin, we just add

        _userDataTableView.WithSameWidth(View).Minus(MARGIN)

我們要做的最后一件事是:

And the last thing we have to do:

        _logoutButton.Height().EqualTo(44), 
        _logoutButton.Bottom().EqualTo().BottomOf(_mainScrollView).Plus(10)

最后一行非常重要.它說要滾動查看正確的內容大小.

last line is very important. It says to scrollView right content size.

這篇關于UIScrollView 中的自動布局使用 Cirrious.FluentLayouts.Touch的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

how to set scrollview content size in swift 3.0(如何在 swift 3.0 中設置滾動視圖內容大小)
Stop a UITableView from automatically scrolling(阻止 UITableView 自動滾動)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模擬器上運行時,使用 iOS 6.0 SDK 并為 iOS 5 Target 構建會導致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
主站蜘蛛池模板: 色综合久久伊人 | 成人免费视频网站在线看 | 免费黄色片视频 | 国产激情视频网址 | 亚洲高清在线 | 伊人最新网址 | 国产免费一区二区三区 | 在线精品亚洲欧美日韩国产 | 国产欧美日韩视频 | 99精品久久久久 | 久久亚洲一区 | 精品一区二区三区四区五区 | 免费在线一区二区 | 久久久久久国产精品mv | 久久久综合精品 | 亚洲精品免费在线观看 | 亚洲国产精品一区二区久久 | 99福利在线观看 | 亚洲国产一区视频 | 欧美在线一区二区三区 | 999精品视频 | 久久国产精品一区二区三区 | 国产视频综合 | 亚洲一区久久 | 午夜男人视频 | 国产成人在线看 | 欧美激情第一区 | 日韩精品免费 | 亚洲精品视频久久 | 日本欧美国产 | 亚洲福利 | 人妖av| 色在线视频网站 | 亚洲视频在线看 | 欧美三级电影在线播放 | 亚洲36d大奶网 | 亚洲精品乱码久久久久久蜜桃 | 91xxx在线观看 | 国产成人99| 国产精品91视频 | 欧美一卡二卡在线 |