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

如何在 Swift 中設置 UIScrollView 高度

How to set UIScrollView Height in Swift(如何在 Swift 中設置 UIScrollView 高度)
本文介紹了如何在 Swift 中設置 UIScrollView 高度的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在使用 swift 構建應用程序.我想使用情節提要向我的視圖控制器添加一些內容.

我已經把所有東西都放在了滾動視圖中并設置了特定的高度,但是當我運行應用程序時,滾動視圖總是設置得比視圖底部的按鈕長

我希望滾動視圖在按鈕之后立即停止

請幫我解決這個問題

謝謝

滾動后

為了您的信息,請忽略 'critics' 和提交按鈕之間的空白,因為實際上它們之間有 UITextView 但不可見(仍然嘗試添加一些邊框)

這些是我的故事板預覽

解決方案

1) ScrollView Contraints

2) ScrollView -> contentView 滾動視圖的約束與上圖相同

3) 現在 ContentView 的寬度和高度約束到主視圖[嵌入了 ScrollView 的 SuperView] 和約束如下.

4) 現在單擊 EqualWidth 以查看 [從頂部開始的第三個約束] 并按照步驟 6 進行編輯

5) contentView 寬度約束

6) ContentView 高度約束//設置優先級 [必須] .在這里,您需要將菜單中的第一項和第二項更改為如圖所示 First as - ContentView.Height 和第二個 as - View.height 并將優先級設置為 250 在此之后,情節提要中將出現一條虛線沿 contentView

7) 現在在 contentView 中添加 [UIView, labels, textfields] 之類的內容,并將約束作為 Top upperMost 視圖頂部空間添加到 contentView [就像我一樣]DoubleRight imageView

我的 DoubleRight imageView 的約束是

在給定頂部空間 20 點的情況下查找頂部空間邊距

同樣你需要為你將添加到 ContentView 中的最后一個項目做同樣的事情,就像我有 uiView 一樣

將各自視圖的底部空間添加到您的 superView[ContentView] 中,我的約束是:

在您初始化所有這些步驟后,每個屏幕尺寸的結果都將與預期一樣,無需額外更改屏幕尺寸的高度

注意:-[所有視圖必須通過 top 和 bottom 參數相互連接]

像 Flow 一樣

View1 - 頂部到 contentView,底部到 View2View2 - 從頂部到 View1,從底部到 view3View3 [Last view] - 頂部到 View2 和底部到 contentView,如圖所示

使用uiView,uiimageViews的高度必須是固定的

I'm using swift to build an application. I want to add some content to my view controller using storyboard.

I already put everything inside the scrollview and set the specific height, but however when I run the application, the scrollview always set longer than the button in the bottom of the view

I want the scroll view stop right after the button

Please kindly help me how to solve this problem

thank you

after scrolling

for your information, please ignore the white space between 'critics' and submit button, because actually there's UITextView between them but not visible (still try to add some border)

these are my storyboard preview

解決方案

1) ScrollView Contraints

2) ScrollView -> contentView Constraints to scroll View same as above image

3) now ContentView width and Height Constraints to main View [SuperView in which ScrollView is embedded] and constraints will be as follows.

4) now click on the EqualWidth to View [Third constraint from top]and edit it as in step 6

5) contentView Width Contraint

6) ContentView Height Constraint // set priority [must] . here you need to change the first item and second item in the menu to as shown First as - ContentView.Height and second as - View.height and set priority to 250 after this a dotted line will appear in storyboard along the contentView

7) now add the content like [UIView, labels, textfields] in contentView and add constraints as Top upperMost view top space to contentView [like I have]DoubleRight imageView

and constraints for my DoubleRight imageView are

look for the Top space margin its given a top space 20 points

and same you need to do for the last item you will be adding in ContentView like I have uiView

add bottom space from this respective view to your superView[ContentView] and my constraints are:

after you had initialed all these steps results will be as Expected for every Screen size no need to change height additionally for screen sizes

Note : - [all the views must be connected to each other with top and bottom parameter]

like Flow will be

View1 - top to contentView and bottom to View2
View2 - top to View1 and bottom to view3
View3 [Last view] - top to View2 and bottom to contentView as shown 

using uiView, uiimageViews their heights must be fixed

這篇關于如何在 Swift 中設置 UIScrollView 高度的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 可縮放?)
主站蜘蛛池模板: 免费成人在线网站 | 亚洲第一在线 | 亚洲色图在线观看 | 亚洲欧美日韩精品久久亚洲区 | 日韩在线免费 | 亚洲综合在线视频 | 成人不卡一区二区 | 午夜看看 | 一区二区精品在线 | 激情福利视频 | 91资源在线 | 国产一区二区三区视频 | 久久久综合色 | 欧美久久久久 | 色婷婷久久综合 | 色婷婷综合在线观看 | 国产午夜精品久久久 | 国产欧美在线 | 五月婷婷丁香 | 色婷婷精品久久二区二区蜜臂av | 国产日产精品一区二区三区四区 | 久久久久久网 | 日韩欧美国产综合 | 国产精品一区一区 | 欧美a∨ | 亚洲美女av网站 | 国产精品欧美一区二区三区不卡 | 一级黄色网页 | 97人澡人人添人人爽欧美 | www国产精品| 欧美日韩在线观看一区 | 久久看精品 | 午夜小电影 | 麻豆视频国产在线观看 | 喷潮网站 | 成人午夜视频在线观看 | 国产精品久久久久久久久免费樱桃 | 色av一区二区 | 免费亚洲婷婷 | 日韩成人久久 | 黄色大片毛片 |