UIView 就像花哨的应用程序配置文件

UIView like fancy app profile

我正在尝试开发一个具有应用 Fancy 的个人资料视图外观的视图。

https://appsto.re/es/VA0ry.i

真正困扰我的是分页水平滚动和垂直滚动分页以及具有选择器和滚动这样的粘性菜单。

有人可以指导我吗?

谢谢。

根据您的建议,我创建了这个视图:

    import UIKit

class DetalleTiendaScrollViewController: UIViewController, UIScrollViewDelegate {

    @IBOutlet weak var scrollView: UIScrollView!
    var pagesContainer = DAPagesContainer()

    var sugerencias:MyCompraCollectionViewController!
    var vistaOfertas:OfertasCollectionViewController!



    var ofertasConnection:OfertasConnection = OfertasConnection()
    var sugerenciasConnection = SugerenciasConnection()


    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        self.pagesContainer.setSelectedIndex(pagesContainer.selectedIndex, animated: false)
    }
    override func viewWillDisappear(animated: Bool) {
        super.viewWillDisappear(true)
        ofertasConnection.activa = false
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        scrollView.delegate = self
        pagesContainer.willMoveToParentViewController(self)

        //        pagesContainer.setSelectedIndex(1, animated: false)
        var altoNavigation = UIApplication.sharedApplication().statusBarFrame.size.height
        if let navHEit = navigationController?.navigationBar.frame.size.height {
            altoNavigation = altoNavigation + navHEit
        }
        var altoTab:CGFloat = 0
        if let b = self.tabBarController?.tabBar.frame.size.height {
            altoTab = b
        }
        pagesContainer.view.frame = CGRectMake(0, 370, self.scrollView.frame.size.width, self.scrollView.frame.size.height+500)
        pagesContainer.view.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight

        pagesContainer.view.setTranslatesAutoresizingMaskIntoConstraints(false)
        self.scrollView.addSubview(pagesContainer.view)



        pagesContainer.didMoveToParentViewController(self)

        self.sugerenciasConnection.getSugerencias()
        self.ofertasConnection.getOfertasOnline(0)



        vistaOfertas = self.storyboard?.instantiateViewControllerWithIdentifier("OfertasCollectionViewController") as! OfertasCollectionViewController
        vistaOfertas.ofertasConnection = self.ofertasConnection
        vistaOfertas.indice = 1

        vistaOfertas.collectionView!.gestureRecognizers = self.scrollView.gestureRecognizers


        sugerencias = self.storyboard?.instantiateViewControllerWithIdentifier("MyCompraCollectionViewController") as! MyCompraCollectionViewController
        sugerencias.sugerenciasConnection = self.sugerenciasConnection
        sugerencias.indice = 2


        vistaOfertas.didMoveToParentViewController(self)
        sugerencias.didMoveToParentViewController(self)


        vistaOfertas.title = "Ofertas online"
        sugerencias.title = "Sugerencias"

        pagesContainer.viewControllers = [sugerencias,vistaOfertas]
        println(scrollView.contentSize)
        self.scrollView.delaysContentTouches = false
        self.scrollView.canCancelContentTouches = false
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func scroll(sender: AnyObject) {
        self.scrollView.setContentOffset(CGPointMake(0, 200), animated: true)
    }

    func scrollViewDidScroll(scrollView: UIScrollView) {

        println(self.scrollView.contentOffset)
        if scrollView.contentOffset.y >= 305 {
            self.scrollView.contentOffset.y = 305
        }
    }
}

但是当我在vistaOfertas中滚动时,在vistaOfertas和ScrollView中重现了滚动。有什么方法可以防止在 scrollView 的 contentOffset 没有 305 时进行滚动?

谢谢

这是一个非常宽泛的问题。我将从实现水平滚动和屏幕顶部开始。从那时起,您可以考虑添加垂直滚动来包裹所有现有内容,或者简单地添加一个平移手势来处理用户开始滚动到顶部的情况(您需要手动更改当用户 scrolling/dragging 向上时屏幕顶部,如果你想让它的外观和行为像你所指的应用程序)。

那时您可能会开始 运行 处理不同手势/滚动视图之间的通信问题。一个会打断另一个,或者 "steal" 印刷机。有多种处理方法,具体取决于您将面临的具体问题。我强烈推荐观看 Session 235 (Advanced Scrollviews and Touch Handling Techniques) from WWDC 2014 它通过各种手势和滚动视图一起工作来准确地讨论这些问题。

祝你好运!