Image("collection_none")
//.resizable()
.resizable(capInsets: EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10),
resizingMode: .tile)
//.renderingMode(.template)
.frame(minWidth: 50, idealWidth: 200, maxWidth: 300,
minHeight: 15, idealHeight: 200, maxHeight: 300,
alignment: .center)//设置宽高以及对齐方式
.fixedSize() //默认纵横向都固定为理想尺寸
//.fixedSize(horizontal: true, vertical: false)//横向固定为理想尺寸
.foregroundColor(Color.red)//对比UIKit中tintColor
.background(Color.white) //背景颜色
//在视图上覆盖一个视图,并设置其对齐方式
//.overlay(Color.gray.opacity(0.5), alignment: .bottom)
//不知道什么用,是层级的下标吗?但是时double类型。。。
//.zIndex(3)
//.position(CGPoint(x: 20, y: 30)) //设置中心点坐标
//.offset(x: 30, y: 30) //x,y偏移量
//.padding(30) //设置上下左右边距为30
//.padding(.all, 10)
.tag(1) //设置tag值
//Shape: 圆Circle, 圆角Capsule
.clipShape(Capsule(), style: FillStyle()) //裁剪形状
.cornerRadius(10) //圆角
.cornerRadius(10, antialiased: true) //圆角,裁剪的时候是否平滑
//.border(Color.green, width: 1)//边框颜色及宽度
///移除了UIKit中的alpha
//.opacity(0.5) //透明度
.shadow(radius: 0.5)
.shadow(color: .black, radius: 0.5, x: 2, y: 2)//阴影
//.blur(radius: 0.2, opaque:false) //模糊效果
///手势
.onTapGesture { //tap手势事件
print("onTapGesture")
withAnimation {
self.zoomed.toggle()
}
}
.onLongPressGesture {//长按手势事件
print("onLongPressGesture")
}
///事件,出现,消失,拷贝,剪切等等...
// 出现
.onAppear {
print("onAppear")
}
// 消失
.onDisappear {
print("onDisappear")
}
//事件控制
//.hidden() //隐藏
//.disabled(true) //是否禁止响应事件,默认为false
//.deleteDisabled(false) //是否禁止删除
//.moveDisabled(true) //是否禁止移动
//.rotationEffect(Angle(radians: 45 * (self.zoomed ? 1 : 2)))
Image
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 前几天把网上找的一个检测抓取框的代码改成ROS node发现结果一直很离谱,抓取框坐标比图片还大,今天突然想起来又...
- tf.image.convert_image_dtype功能:将图像转换为dtype,如果需要,缩放其值。API定...
- 简介 Unsupervised attention-guided image-to-image transla...