gpt4 book ai didi

ios - 如何在 Eureka 表单上实现滑动 ImageView 作为标题

转载 作者:行者123 更新时间:2023-11-30 13:05:47 25 4
gpt4 key购买 nike

I am unsure how to implement a sliding imageview like the one in the top of this screenshot.

我正在使用 Eureka 表单,并且我正在尝试将此滑动 ImageView 包含为标题。

目前我正在使用自定义 View ,而这个 Library

我认为问题的根源是由手势识别器和“单击”方法引起的。 Xcode 在 self.presentViewController(ctr,animated: true,completion:nil) 行上抛出错误。我知道它不能在 UIView 中呈现 View Controller 。我只是不确定如何实现在 UIView 子类中呈现 View Controller 的相同结果。

这是我的代码:

class profilePicHeader: UIView {

let slideshow = ImageSlideshow()
var slideshowTransitioningDelegate: ZoomAnimatedTransitioningDelegate?

override init(frame: CGRect) {
super.init(frame: frame)

let localSource = [ImageSource(imageString: "GardenExample")!,ImageSource(imageString: "OvenExample")!]


slideshow.backgroundColor = UIColor.whiteColor()
slideshow.pageControlPosition = PageControlPosition.UnderScrollView
slideshow.pageControl.currentPageIndicatorTintColor = UIColor.lightGrayColor();
slideshow.pageControl.pageIndicatorTintColor = UIColor.blackColor();
slideshow.contentScaleMode = UIViewContentMode.ScaleAspectFill


slideshow.setImageInputs(localSource)


let recognizer = UITapGestureRecognizer(target: self, action: #selector(profilePicHeader.click))
slideshow.addGestureRecognizer(recognizer)

slideshow.frame = CGRectMake(0, 0, 320, 200)
slideshow.autoresizingMask = .FlexibleWidth
self.frame = CGRectMake(0, 0, 320, 130)
slideshow.contentMode = .ScaleAspectFit
self.addSubview(slideshow)
}

func click() {
let ctr = FullScreenSlideshowViewController()
ctr.pageSelected = {(page: Int) in
self.slideshow.setScrollViewPage(page, animated: false)
}

ctr.initialImageIndex = slideshow.scrollViewPage
ctr.inputs = slideshow.images
slideshowTransitioningDelegate = ZoomAnimatedTransitioningDelegate(slideshowView: slideshow, slideshowController: ctr)
// Uncomment if you want disable the slide-to-dismiss feature on full screen preview
// self.transitionDelegate?.slideToDismissEnabled = false
ctr.transitioningDelegate = slideshowTransitioningDelegate
self.presentViewController(ctr, animated: true, completion: nil)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

最佳答案

我的解决方案是使用容器 View 和页面 View Controller 。您添加一个容器 View 并设置自动布局约束来调整容器的大小,然后将所有图像添加到内部的页面 View Controller 中。

关于ios - 如何在 Eureka 表单上实现滑动 ImageView 作为标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39391552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com