iOS CollectionView with horizontal paging instead of vertical scrolling - ios

I'm working on a project for a client. It's an iPad pdf reader. The client wants a collection view, but instead of scrolling vertically, he wants it to use a page control.
It's pretty hard to explain, but what I basically want is all the PDFs on the device in a grid, like on the iBooks app. When that grid overflows, I want to use a page control to display the extra elements on a second page (like in the weather app).
My thoughts on this were:
- Create a page control with one page.
- On that page, create a UICollectionView.
- If the number of elements is greater than 9 add a page to the page control and add another UICollectionView, until there are enough pages to display all elements.
However, this seems horribly inefficient, so my question is if there's a better way to do this.

If your goal is to scroll sideways you can just select that in the interface builder when you have the collection view selected. Then you can make the cell as big as you want. You can even enable paging on the collection view.
In the attributes inspector, right under layout is scroll direction. Set to horizontal.

Related

iOS Swift: Expandable/Collapsable View that contains a Horizontally Scrolling List

Im am relatively new to Swift/iOS and i have a quite complex task to Accomplish, and i want to know the best way for doing that.
I need to have a Custom View. This View displays some content, e.g. a news-article. If the user taps on the View, it expands and shows a more detailed version of the news article. Also, the user cann scroll horizontally (in the expanded or collapsed state) to get to the next article.
A Visual explanation
I searched for each problem individually. For scrolling, i found that i can use a scrollview with paging enabled, so that each swipe will lead to the next article. But im not sure if that is the best solution for my problem.
For expanding/Collapsing a view, i only have the idea to programmatically set the size of the view to fill the screen, so that auto layout would no longer display everything that is located beneath our custom view. Would that be possible? And is there any better solution?

How to make auto expandable home page banner like

I have used the separate banner image and scroll view for category sections and tableview for records.
Need to make all things scrollable to topside and when the scroll position reached the top position category section would fixed at top position and the table view records would continue scrolling and once the scroll down all the object would displayed to their original position back to back well which is normally happen in android apps and whatsapp profile page.
Please share your answer if you have done like this.
Here is the link for DTParallaxTableView
QMBParallaxScrollViewController
This Library same you want MXSegmentedPager
May this helps lot.

ios 8 layout using uitableview static cell & uitableview dynamic prototypes

I work on a app, nothing fancy, but since is my first app, there alot of stuff I never did before.
So, I'm trying to build a view like the image attached.
I've looked up on the Internet how to do something like that but I don't know what is better/cleaner way to do.
As you can see I have 3 areas: the title, the tableview in the middle and a button on the lower side.
The table will expand based on the content (3 lines or 30 lines) so the button must move down and a scroll bar should appear.
So, my idea:
Using a tableview having 3 static cells: one to put my title, second to put a tableview having prototypes cells, and a third one for the button.
That way I would have a scroll bar when the table in the middle grows, pushing the button.
Here I have a question: how to have the table view (the inner tableview) resize itself, pushing the height of the middle row, instead of having a fixed width with a scroll.
Is the the best way to achieve that?
Thanks for any idea.
C.C.
Are you sure you want to push the bottom UI down as the table grows? You say whether the table has 3 or 30 cells, but what if it has 300 cells? Your user then has to scroll to the bottom to reach the button and tab bar. I think you'll find that it would be better to use Auto Layout and let the table fill the screen space between the title and the button. The table will scroll so if you have 300 cells then you can scroll through inside the table's available area.
The advantage here is you won't be fighting with Auto Layout. If your user rotates an iPhone 4S into landscape you'll only have a few rows displayed but conversely if they run in portrait on an iPad you'll fill all of that space.
As for how to do it, the other advantage is that you don't need the nested table you describe. Use a constraint to attach the title label to the top layout guide, then attach the tab bar to the bottom layout guide. Put a vertical space constraint between the button and the tab bar. Finally, put vertical space constraints between the table and the title & the table and the button. (You'll need to implement constraints for the horizontal axis as well, but that's pretty simple.)
There's are refinements you can put into place if you want the table to shrink to fit if there are only 3 rows, but this should get you started and you may not want that anyway.
Key point: the tableView wants to scroll naturally, inside a view sized to fit the display. Don't change that behavior unless you really have to. Neither your users nor UIKit expects what you're trying to do, and the table is going to fight you all the way about it.
Nesting UIScrollViews (which your nested table would do) works, but it opens up a lot of bad UI flow problems. In my experience every time somebody wants nested scrollViews there's some other approach which is more "natural" to iOS interface paradigms.
If you're dead set on the UI you described I wouldn't use a table for the outer structure. Just make it a UIScrollView and calculate your content size based on the number of rows the table will display. You can actually do that, and then use Auto Layout as I described.

If I have different UI controls to display sequentially, should I still use a table view controller?

I want to implement something similar to this- (focus on the left portion)
I imagine possible implementations to be
Making a table view with (in this case) 7 'normal' cells, one normal size cell with a custom right accessory item, one 3XL cell containing a button, and finally a normal size cell with an imageview and custom accessory item.
or
Making a scroll view with styled view containing UILabels masquerading as 'cells', a button within a larger UIView, and another faux view-with-label-cell.
Considering the challenges posed by different screen sizes, and the want for easy configuration and modification- which way should mixed sequential data be displayed? Hacky table view, redundant scroll view, or reinvented custom UIView?
Edits
I am currently using a sliding view controller. The sliding functionality is of no worry to me, the contents of the scroll/table view within is.
There are various open source libraries available on net/github. you can use this https://github.com/edgecase/ECSlidingViewController.
Although you can make your own if you want but doing this using scrollview I don't think it will be a good way to do that.
Edit
You basically have to create 8 normal cells and change the color of the cell label which is selected. And create a footer view of YUTableview for last view.
You can use Slide-Out Navigation Panel. Use this slide-out-navigation for better understanding.
I've found more information on this, and I definitely overcomplicated a simple matter.
The answer is yes (use the table view), and there are multiple reasons- the first being the principle of always using the highest level of abstraction where practical.
StaticUITableViewCellsare completely capable of rendering other UI elements (buttons, sliders, etc) inside themselves from stock, and this is encouraged in Apple's UITableView spec. Dynamic cells, stock, are not as flexible but they can be subclassed from UITableViewCell for more custom functionality.
To speak for the example, the first X (in this case, 7) cells are likely dynamic, and the last 3 cells are static. The 'second to last' cell seems to have an infinite(?) height, and the last cell appears to be a sticky tableview footer.

Separate scrollbar of different UI component within a view iOS

I am creating an iPad app that has single view. the left part of the view is a tableView and the right part is a webView. When user clicks on a cell in the table, the webView to the right load the web page that the cell's stored URL points to. Now, everything works fine, except for the whole screen has only one scroll bar.
What I want is something like the Facebook App which you can choose to scroll the left tableView without scrolling the webView and the scrolling of the webView does not affect the tableView. I don't know if it is the problem of running on simulator, there seems to be only one scrollbar for the whole App, and if I scroll my finger on the touchpad of Mac, the whole iPad simulator screen gets scrolled, instead of the individual UI area (tableView or webView) where my mouse lies. Could anyone shed some light? Thanks!
It sounds like you have a problem with your view hierarchy. You need to make sure that the web view is not a subview of the table view or vice versa.
Edit:
Based on the screenshot you provided, it seems that your web view is taking up the whole screen. You need to resize the web view so it does not overlap the table view.

Resources