[英]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. 从我的角度来看,我认为,如果您使用UITableView
或UICollectionView
(或UICollectionView
控制器: UITableViewController
和UICollectionViewController
),则比尝试在滚动视图中添加带有图像的按钮要获得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.