feat: 新增图片预览功能与现代图片选择组件
- 在EditFeedView中集成ImagePreviewPager,支持全屏图片预览。 - 更新ModernImageSelectionGrid,添加图片点击事件以触发预览。 - 移除冗余的PhotosUI导入,优化代码结构。
This commit is contained in:
29
yana/Views/ImagePreviewPager.swift
Normal file
29
yana/Views/ImagePreviewPager.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
import SwiftUI
|
||||
|
||||
struct ImagePreviewPager: View {
|
||||
let images: [UIImage]
|
||||
@Binding var currentIndex: Int
|
||||
let onClose: () -> Void
|
||||
var body: some View {
|
||||
ZStack(alignment: .topTrailing) {
|
||||
Color.black.ignoresSafeArea()
|
||||
TabView(selection: $currentIndex) {
|
||||
ForEach(images.indices, id: \Int.self) { idx in
|
||||
Image(uiImage: images[idx])
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(Color.black)
|
||||
.tag(idx)
|
||||
}
|
||||
}
|
||||
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .always))
|
||||
Button(action: { onClose() }) {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.font(.system(size: 32))
|
||||
.foregroundColor(.white)
|
||||
.padding(24)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user