詳解Swift 之clipped是什么如何用
clipped()函數(shù)介紹
Clips the view to its bounding rectangular frame.
將View裁剪成矩形
By default, a view's bounding frame is used only for layout, so any content that extends beyond the edges of the frame is still visible. Use the clipped(antialiased:)modifier to hide any content that extends beyond these edges.
默認情況下,視圖的邊界框架僅用于布局,因此超出框架邊緣的任何內(nèi)容仍然可見。使用clipped(antialiased:)修飾器可以隱藏超出這些邊緣的任何內(nèi)容。
代碼
import SwiftUI
struct ProductCard: View {
var body: some View {
VStack(alignment:.leading,spacing: 0){
Image("circle")
.resizable()
.scaledToFit()
.frame(minWidth:nil,
idealWidth: nil,
maxWidth: UIScreen.main.bounds.width,
minHeight: nil,
idealHeight: nil,
maxHeight: 300,
alignment: .center
)
.clipped()
}
}
}
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
iOS開發(fā)之獲取系統(tǒng)相冊中的圖片與視頻教程(內(nèi)帶url轉(zhuǎn)換)
本篇文章主要介紹了iOS開發(fā)之獲取系統(tǒng)相冊中的圖片與視頻教程(內(nèi)帶url轉(zhuǎn)換),主要介紹AssetsLibrary 框架,具有一定的參考價值,有需要的可以了解一下。2016-11-11
IOS UI學習教程之使用代碼創(chuàng)建button
這篇文章主要為大家詳細介紹了IOS UI學習教程之使用代碼創(chuàng)建button,感興趣的小伙伴們可以參考一下2016-03-03
詳解iOS App中UIPickerView滾動選擇欄的添加方法
UIPickerView組件在應(yīng)用中選擇地區(qū)等方面的運用非常常見,能夠提供多列的選擇項,下買呢我們就來詳解iOS App中UIPickerView滾動選擇欄的添加方法2016-05-05
iOS應(yīng)用開發(fā)中的文字選中操作控件UITextView用法講解
這篇文章主要介紹了iOS應(yīng)用開發(fā)中的文字選中操作控件UITextView用法講解,代碼基于傳統(tǒng)的Objective-C語言,需要的朋友可以參考下2016-02-02
iOS中UIScrollerView的用法及基于AotoLayout的控件懸停
這篇文章主要介紹了iOS中UIScrollerView的用法及基于AotoLayout的控件懸停,文中對于UIScrollerView的方法及屬性介紹地非常詳細,十分推薦,示例代碼為Objective-C,需要的朋友可以參考下2016-03-03

