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

UIScrollView + 居中視圖 + 模糊的可滾動內容大小

UIScrollView + Centered View + Ambigous Scrollable Content Size + many iPhone sizes(UIScrollView + 居中視圖 + 模糊的可滾動內容大小 + 許多 iPhone 尺寸)
本文介紹了UIScrollView + 居中視圖 + 模糊的可滾動內容大小 + 許多 iPhone 尺寸的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有:

  • 應用程序,應該可以在橫向和縱向模式下運行.
  • 頂部帶有全尺寸滾動視圖的視圖.
  • 滾動視圖內的一些視圖,具有固定的寬度和高度.(添加了 H 和 W 約束)
  • 設置為在容器中水平居中查看滾動視圖.(根據約束添加)

我在界面生成器中收到警告具有不明確的可滾動內容寬度".

據我所知,解決此問題的唯一方法是設置尾隨和前導約束.但對于不同的 iPhone(5.5"、4.7"、4"),我需要設置不同的尾隨和前導約束.

我怎樣才能消除這個警告,并且仍然在所有 iPhone 尺寸的固定 W 和 H 的情況下保持居中的水平視圖?

我創建 Github repo 來說明這個問題:

附言

我不知道它為什么起作用以及 Xcode 如何檢測哪個約束的優先級更高(因為我沒有明確為這些約束設置優先級),但如果有人解釋,我將不勝感激,為什么它在下面的評論中起作用.

I have:

  • application, that should work in landscape and portrait mode.
  • view with full-size scroll view on top.
  • some view inside scroll view with fixed width and height. (with added H and W constraints)
  • set to view inside scroll view as horizontal centered in container. (added according constraint)

I have warning in interface builder "Has ambiguous scrollable content width".

The only way to fix this problem, that I know - is set trailing and leading constraints. But for different iPhones (5.5", 4.7", 4") I need to set different trailing and leading constraints.

How can I eliminate this warning and still have centered horizontally view with fixed W and H for all iPhone sizes?

I create Github repo to illustrate this problem: ScrollViewAmbigous

This is not duplicate of UIScrollView Scrollable Content Size Ambiguity , but it similar (and not answered although), but this question especially related to different sizes of iPhones.

解決方案

In the morning with a fresh cup of coffee I figured out workaround for this issue!

So, here is the initial state for simplest case:

  1. scrollView with 0 constraints to all edges
  2. Button centered Horizontal and Vertical with fixed Width and Height
  3. And, of course Has ambiguous scrollable content width and Has ambiguous scrollable content height annoying warnings.

All, that we have to do is:

  • Add 2 additional constraints, for example "0" for trailing and/or bottom space for our view (in my case - UIButton)

Important: you have to add trailing and/or bottom constraints. Not "leading and top" - it's not works!

You can check it in my example project, that demonstrating how to fix this issue: ScrollViewAmbigous

P.S.

I don't know why it works and how Xcode detect which constraint is more prioritised (because I'm not set priority for these constraints explicity), but I'll be thankful if someone explain, why it works in comments below.

這篇關于UIScrollView + 居中視圖 + 模糊的可滾動內容大小 + 許多 iPhone 尺寸的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

UIButtons at the bottom of UIScrollView not working(UIScrollView 底部的 UIButtons 不起作用)
scrollViewWillEndDragging:withVelocity:targetContentOffset: not working on the edges of a UISCrollView(scrollViewWillEndDragging:withVelocity:targetContentOffset: 不在 UISCrollView 的邊緣工作) - IT屋-程序員軟件開發技術分享社
ImageView Scaling when scrolling down(向下滾動時 ImageView 縮放)
Bounds automatically changes on UIScrollView with content insets(UIScrollView 上的邊界自動更改,帶有內容插圖)
iOS5 UITapRecognizer for UIScrollView interfering with buttons. How to fix?(用于 UIScrollView 的 iOS5 UITapRecognizer 干擾按鈕.怎么修?)
Handling scroll views with (custom, interactive) view controller presentation and dismissal(使用(自定義、交互式)視圖控制器呈現和解除處理滾動視圖)
主站蜘蛛池模板: 色女人天堂| 91视在线国内在线播放酒店 | 中文字幕在线免费视频 | 色综久久| 91porn成人精品 | 国产亚洲精品久久久优势 | 中文字幕高清在线 | 91影院在线观看 | ww 255hh 在线观看| av小说在线 | 日日天天| 亚洲一区在线播放 | 日韩欧美在线播放 | 日日骚网| 最新91在线| 女同av亚洲女人天堂 | 国内精品久久久久 | 国产欧美视频一区二区三区 | 538在线精品 | 毛片久久久 | 亚洲成人国产精品 | 国产天堂 | 精品久久久久一区 | 免费观看一级黄色录像 | 欧美性猛片aaaaaaa做受 | 操人网站 | 日韩精品一区二区在线 | 日本免费在线看 | 羞羞视频在线观免费观看 | 韩日一区二区 | 中文字幕一区二区三区精彩视频 | 中文字幕一区二区三区精彩视频 | www午夜视频 | 日韩一区二区在线观看视频 | 成人在线免费观看视频 | 国产日韩中文字幕 | 午夜精品久久久 | 91久久精品视频 | 久久大 | 日韩毛片在线视频 | 国产成都精品91一区二区三 |