Ios UIView-like花式应用程序配置文件
我正在尝试开发一个应用程序外形视图的视图 真正让我烦恼的是,页面水平滚动和页面垂直滚动,以及像选择器和滚动一样的粘性菜单 有人能指引我吗 谢谢 根据您的建议,我来创建此视图:Ios UIView-like花式应用程序配置文件,ios,xcode,uitableview,uiscrollview,uicollectionview,Ios,Xcode,Uitableview,Uiscrollview,Uicollectionview,我正在尝试开发一个应用程序外形视图的视图 真正让我烦恼的是,页面水平滚动和页面垂直滚动,以及像选择器和滚动一样的粘性菜单 有人能指引我吗 谢谢 根据您的建议,我来创建此视图: import UIKit class DetalleTiendaScrollViewController: UIViewController, UIScrollViewDelegate { @IBOutlet weak var scrollView: UIScrollView! var pag
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没有设置值时,是否有任何方法防止滚动
谢谢这是一个非常广泛的问题。我将从实现水平滚动和屏幕顶部开始。从这点上,您可以考虑添加垂直滚动来包装所有现有内容,或者只需添加一个PAN手势来照顾用户开始滚动到顶部的情况。(当用户向上滚动/拖动时,您需要手动更改屏幕顶部,如果您想使其外观和行为与您所指的应用程序相似的话) 在这一点上,您可能会开始遇到不同手势/滚动视图之间的通信问题。一个会打断另一个,或者可能“偷走”压力机。根据您将面临的具体问题,有多种处理方法。我强烈建议您观看 它通过各种手势和滚动视图精确地讨论这些问题,所有这些都在一起工作
祝你好运!我甚至不确定你的问题是什么或你想要什么。请你澄清并提供你已经尝试过的代码,以便我们可以看看你是否尝试自己解决这个问题。谢谢你的提示,但对我来说还不是很好。完成我得到的东西。这是正确的方法吗?我不确定你为什么要删除它这是正确的答案,或者你现在的确切问题是什么。你看了我介绍给你的WWDC会议了吗?你在这里提出的问题需要相当多的工作才能实现。这款高级应用程序的开发人员并没有在一天内实现它。这需要你方面做更多的工作和研究。我只是想给你指出正确的方向我的建议是,你开始做这件事,如果你有具体的问题,把它们贴出来,并为它们获取答案……对不起,我不小心取消了选中