简体   繁体   English

UIScrollView中的UIButton

[英]UIButton inside a UIScrollView

I would like to use a scroll view inside my app.I will explain the situation: Mine is a recipe app.I would like to show all the recipe images inside a scroll view and when i click an image inside the scroll view ,the corresponding ingredients and preparations has to be shown .I saw many tutorials using image view inside the uiscrollview,thought of replacing image view with button.But all those tutorials are so complicated .Can any one refer me a simple example. 我想在我的应用程序内使用滚动视图。我将说明情况:我的是一个食谱应用程序。我想在滚动视图内显示所有食谱图像,当我单击滚动视图内的图像时,相应的必须显示成分和准备。我在uiscrollview内看到了很多使用图像视图的教程,都想用按钮替换图像视图。但是所有这些教程都很复杂。任何人都可以参考我一个简单的例子。 在此处输入图片说明 This my apps seccond page.when i click a particular recipe in first page its image and ingredients and preparation is shown.But i would like to show all the images in uiscrollview,and when i click a particular image,corresponding ingredients and preparations has to be shown 这是我的应用的第二页。当我单击第一页中的特定配方时,将显示其图像,成分和制备。但是我想在uiscrollview中显示所有图像,当我单击特定图像时,必须使用相应的成分和制备。被显示

From my point of view I think that if you would use a UITableView or a UICollectionView (or the corespondent controllers: UITableViewController and UICollectionViewController ) you would achieve grater results than trying to add buttons with images inside a scroll view. 从我的角度来看,我认为,如果您使用UITableViewUICollectionView (或UICollectionView控制器: UITableViewControllerUICollectionViewController ),则比尝试在滚动视图中添加带有图像的按钮要获得UICollectionViewController效果。

UITableView Tutorial and UICollectionView Tutorial UITableView教程UICollectionView教程

Also you can go and watch the Apple's WWDC videos 您也可以去观看Apple的WWDC视频

I hope this is helpful for you, Cheeers 希望对您有帮助

Place UIscrollview In View Xib, then add UIButtons Inside UIScrollview , set buttons actions by hooking action type touch up inside in button pressed add subview on UIView and Show details of Recipe.[self.view addSubView:RecipeDetailView]; 将UIscrollview放置在View Xib中,然后在UIScrollview内添加UIButtons,通过钩挂动作类型来设置按钮动作,在按下的按钮内向内触摸,在UIView上添加子视图,并显示Recipe的详细信息。 here recipe detail view subview where you load reciepe info on button pressed. 在这里,配方详细信息视图子视图可在您按下按钮时加载收货信息的子视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UIScrollView内的UIView上的UIButton - UIButton on UIView inside UIScrollView UIButton在UIScrollView内部不起作用 - UIButton not working inside UIScrollView UItableViewCell内的UIScrollview中的UIButton处理带有数据的事件 - UIButton in UIScrollview inside UItableViewCell handle event with data 点击时 UIScrollView 内的 UIButton 延迟 - UIButton inside UIScrollView delay when tap 即使添加了约束,UIScrollview内部的UIButton也不会使用UIScrollView调整大小 - UIButton inside UIScrollview not resizing with UIScrollView even after adding the constraints UIVutton里面的UIVutton里面的UIScrollView没有触发tap动作 - UIButton inside UIView inside UIScrollView not firing tap action UIScrollView内的UIViewControllers内的UIbutton不会在触摸时触发 - UIbutton inside UIViewControllers inside UIScrollView not getting triggered on touch 如何快速从UIScrollView内部的超级视图中删除UIView或UIButton - How to remove UIView or UIButton from superview inside UIScrollView in swift iOS-在UIScrollView中添加多个UIButton不能平滑滚动 - iOS - Add multiple UIButton inside UIScrollView not scrolling smoothly 根据电话调整UIScrollView内UIView和UIButton之间的约束高度 - adjust constraint height between UIView and UIButton inside UIScrollView based on phone
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM