I am not the most experienced iOS developer and so far only had some simple designs I worked with, but now we plan to build views based on tiles, which I have no idea how to approach, yet. I tried searching for solutions, but haven’t really found something which could help.
This is what we plan:
Row 1 (fix): Tile 1 (fix) | Tile 2 (fix)
Row 2 (scrollable): Tile 3 | Tile 4 | Tile 5 | Tile 6
(unfortunately I am not allowed to post a picture)
Two tiles per row should always be on the screen.
Each tile should contain its own layout and controls, in fact a MVC for each tile. The top two tiles should stay fixed on the screen, the second row contains four tiles that should be horizontally scrollable.
Could someone point me to the right MVC-architecture I should be using here? Are there maybe iOS controls which already support this.
Any hint on how to begin and how to design it is highly appreciated. Or a link to a tutorial.
I came across the UICollectionView, but I am not sure this is the right approach. I am planning to do that for iOS6, so I can also use the latest available controls/classes.
Thanks a lot for your help!!
Nek
Make a view and a view controller. Add to this view a subview for the fixed tiles. Add to the rest of the screen a UICollectionView as a subview to the view. Assign data source and delegate to the UICollectionView and write the delegate and data source methods. You are done.
You can use the UIScrollView class. In UIScrollView you can make it scrollable as you want.
For your requirement you can use UIScrollView as each row.
Related
All. I am new to Swift. I am trying to create something similar to the image attached below. My question is regarding the table view.
I create a prototype cell for each recipe, in which contains an image View and a textfield. However, how should I arrange those cells like those in the picture attached?
It seems that each cell has a different height. I thought about including multiple recipes in one prototype cell, yet it may not be the right solution.
In the real world, how do people handle such arrangements? Maybe people use something other than prototype cell?
Your help is greatly appreciated. Thanks in advance.
You can achieve this thing by using collectionview. If you know width and hight in advance then you can simply create collectionview with constant width and height of cell. if you don't know the dimensions in advance you need to do some extra task in collectionview which is selfsizingcell.
This is called 'waterfall collection view', you can find similar thing in Pinterest app. Size of each cell is dynamically calculated based on the width&height of picture itself.
Personally I've used this open-source github project, in order to implement same thing in my app.
I'm trying to implement a scrollview where the cells auto zoom as they near a certain point in. As a cell nears the point it will start enlarging and as it moves away - it will shrink. I've been trying to find some tutorials around this but haven't had much luck. Any help would be greatly appreciated.
UICollectionView with a custom layout seems like the right way to do this. A UICollectionViewLayout gets to define the layout attributes for each item, including size and position. All you need to do is define a layout that positions the cells in a grid or however you like, but adjusts the size of the cells according to their distance from the point of interest.
You might find some sample code associated with the collection view talks from WWDC 2012 -- there were some interesting layouts shown there.
This matrix is basically for comparing products in a grid with the ability to touch one of them and to take action based on the touch. The real tricky part is that the matrix should be pannable... with the top row scrolling when panned horizontally while the left-most row stays frozen and with the left-most row scrolling when panned vertically while the top row stays frozen.
I need this in order to compare a large set of products by company and type at the same time, basically a matrix view.
Think of it similarly to a TV guide kind of control.
Is there a third-party library or any other good way to do this on the iPhone/iPad (primarily iPad)?
Is the inner matrix/grid itself scrollable?
It sounds like maybe what you want is a UICollectionView for the grid (or just views if the grid is static) and then two separate scroll views for the left side and top.
Edit:
Okay it makes more sense now that you're comparing it to a TV Guide. I think I would use a UICollectionView and then scroll views for the left side and top. You can capture scroll events or attach pan gesture recognizers to the UICollectionView and then tell the appropriate scroll view to move in tandem with the collection view.
You can use PSTCollectionView to support iOS 5. It's API compatible with UICollectionView.
I have an array and lets say I have 5 objects in it. The array just contains a string with an address to a picture. I would like to use the Page Control feature in the iPhone SDK to swipe Left and Right to change the picture. I already have the multitouch gestures in place all I need is to implement the Page Control so if I swipe left and then right it will take me back to the previous image.
Does anyone know of any good Page Control tutorials or sample code online that may be able to help me thought implementing the Page Control.
The UIPageControl isn't a control as much as it's just an indication of what "page" your on.
To do what you want, you need to set up a UIScrollView and add subviews for each image. It will require some math to figure out where each "page" starts and ends based on image dimensions and screen sizes.
Apple has some docs on using scroll views with page controls here.
Indeed, you need a UIScrollView along with the UIPageControl. You can find a good tutorial on how to make them work together here
Ok so i have a good chunk of my game finished now and Im working on my level select view. I want to implement a horizontal scroll view with multiple buttons on each view, in something that looks like Angry Birds or Cut The Rope, or something like that. I know I use a scroll view and set anchor points from my reading on here and other sites but im not sure exactly how i can implement that. Im a bit of a noob and my game didnt need to implement any real graphics so im not familiar with open gl or quartz, although im not afraid to try to learn it.
Anyone know how i can implement anchor points in a horizontal scroll view for my level select view?
Thanks!
As already answered, you have to use UIScrollView. We use scroll view when our contents are too large to be shown on the screen.
Refer the class reference here and Some links that could hep you.
Apple's scrolling demo
Understanding Scrollview