UITableViewController inside UIScrollView with Horizontal Paging - ios

this is the situation:
I need horizontal scrolling, and table views inside every page. This is something like news app, it should display news from different categories, when scrolled in one horizontal direction, and inside one category it should display about 30 news, vertically scrollable, of course.
I have successfully done what i need, but...
I have following scenario:
UINavigationController
|__ UIViewController, which contains ScrollView and PageControl
|__ UITableViewController, which holds data in rows, and is displayed inside parent, which is actually ScollView
I know that this is not an ideal solution, but at least it works. As a base, i used Apple's code and tutorial for PageScroll found on this link. Instead of simple viewController to add to ScrollView, i used TableViewController, so basically i add tableController.tableView to the ScrollView.
I know, also, that adding tableViews inside scrollview is sort of adding a car inside a truck and driving that car, but i couldn't find more reasonable way of doing same thing.
So, i need your thoughts about how this can be accomplished using some other approach. I use storyboarding and iOS 5 for this, and everything seems (and looks) messy right now.
Thanks in advance, a lot.

I did something similar a few months ago, and it was like this:
UINavigationController
UIViewController with a UIScrollView
UIViewController with a UITableView inside (I use this because I simply hate UITablewViewController)
I followed the Apple's documentation about creating custom containers. There is a great video about that in the WWDC 2011 video's section if I am not mistaken. I can proudly say that the code is really clean and simple to understand.
Answer 1.0
The one thing is, did you managed to get proper orientation handling of the tableView, without any hack, or you don't use it?
No, in this case I didn't, but I am sure I would have been able to do it without any problem. You see, most of the problems come when you just [self.view addSubView:newViewController.view];. You just add the UIView, all the logic of the rotation is handled by the newViewController and not in the controller where the UIView will be.
The other thing is, if i'm gonna try to implement, say, GridView or something like that, for iPad, orientation handling and animations become very ugly.
I implemented this in another project and it was quite easy to implement once you understand what's going on:
I used a UIViewController with a UITableView so I could get all the goodies from the dequeueReusableCellWithIdentifier:, creation of section's titles, table's headers and footers, etc. I just figure that no matter what I would do with a UIScrollView a UITableView is always going to be more optimized. As the UITableViewCell's I just used an holder with 3 squares, each one being a picture. (my application was a showcase of pictures)

http://www.raywenderlich.com/4680/how-to-make-an-interface-with-horizontal-tables-like-the-pulse-news-app-part-1
Chk out above link

Related

(Swift) How to implement a Page Control through paging single views?

I want to implement a page control in my project so that every view can be accessed through swiping left or right. Every example I have looked at is to do with images, not views. I've been studying this and its of course images again. My application is a single view application. I'm not really sure what code snippets to give you so far, I don't think I do because I haven't done anything on this yet. If you need specifics, please comment and ask me, i'll be here all day.
Please help me!
Thanks.
The same idea should apply in the tutorial you cited. They're adding UIImageView to a UIScrollView. So in your case, instead of UIImageView just use UIView. Also you can think of the pageImages array as a data source about your views. For example, instead of an array of UIImage you can just have an array of some model object that helps you configure your view. However, keep in mind that the implementation in the tutorial for your case won't scale if you plan to have a lot of UIViews. That's because you want to effectively reuse views that aren't showing. When it gets to that point, you're better off implementing a UITableView that scrolls horizontally.
You can use UIPageViewController for paging effect. Check out this tutorial. It is written in obj-c but who cares. It will give you idea about using UIPageViewController.

Does iOS Mail App Compose Screen Use UITableView? If so, why?

Is the iOS 7 Apple Mail app is using a UITableview for the composing and viewing message screens? If so, why?
The composition screen appears to be using a UITableView with a UITextfield for the subject row and a UITextView for the message row. What is the benefit? There aren't any table rows similar enough to be reused (Max is 6 if you include cc and bcc), so I don't see a performance benefit. There is no Edit mode (i.e. move, delete rows) on these two screens. The resizing table rows necessary to accommodate long messages seems like an unnecessary headache.
I'm working on an app with a similar text input layout and number of fields. I initially planned to use a UIViewController with UITextField and UITextView placed on a UIScrollView. Examining the Mail app, I'm assuming there's a reason Apple would use a UITableView. Though I don't see what it is.
Insight appreciated.
Table views are REALLY good at a few things, and one of those things is creating forms. All you really need to do is add the fields to the cells and do a little cell customization, and the table view handles all the spacing, formatting, rotation, scrolling, etc.
I built an open source iOS form building library that is build on top of UITableView for just these reasons. (https://github.com/mamaral/MAFormViewController) In my case, if you need to move around or add a new field to the form, it's as simple as updating the data source with a new form-field cell, as opposed to creating a totally new textField, configuring it, determining the frame, moving everything above and below it around accordingly, etc. I would suspect these reasons are similar to why Apple would use table views for forms like the above.
The class chain is:
NSObject - everything subclasses this. you have to be really crazy to not subclass it
UIResponder - anything that responds to user input should be a subclass of this. the message view responds to user input
UIView - anything that draws to the screen should subclass this. the message view draws to the screen
UIScrollView - anything that scrolls should subclass this (note: that's not how it works on OS X! Only on iOS!). The message view scrolls, so it needs to subclass UIScrollView
UITableView - anything that has rows of data should subclass this. The message view has four rows, so it should subclass it.
Basically, it subclasses UITableView because it needs all of UITableView's functionality. So why not subclass it? You are saving yourself thousands of lines of code by doing so.
Duplicating all of UITableView's functionality is very difficult.
Chances are if you write an app without subclassing UITableView, it will be so sucky Apple might even reject it from the store, telling you to go back and make it work properly. Which would mean subclassing UITableView or else writing thousands of lines of code — for example Voice Over is a huge pain in the ass if you don't subclass UITableView.
If you don't want to restrict yourself to rows of data, consider using a Collection View.

iOS Design implementation recommandations

I would like to know how to handle, for my iOS app, the following situation:
I have to deal with something like this (basicly this is an article with comments, received from a server):
=- Text and Images -=
=- UIWebView -=
=- List of Comments -=
Now, I came up with two solutions:
Have the content above the list of comments wrapped in a UIScrollView, and create Views for each and everyone of the comments (don't know many of them could be), and
Make the list of comments a UITableView, and the above content its Header.
Which of these (or possibly another if you have any recommandations) should I choose? It may look not very important, but I would like to know this, so I could use the idea in further developing.
I would use a UITableView with a custom UITableViewCell wich holds the comments.
It will definitely have a better performance the UITableView than the UIScrollView since the UITableView re-uses the cells.
Using a UITableView you will just have to worry about customising the cells for the comments.
Otherwise if you want to use the UIScrollView in case you have a lot of comments you will have to create manually a way to reuse them which is what the UITableView does.
If you want something like facebook, so that the context + comments both are movable,then go with option 2.
But, if you want content always at the top, go with option 1.
Indeed, UITableView is a subclass of UIScrollView.
And If you think you might have many comments like (50+),
If you use scrollView, then you should have to supply scrollView with those number of UIView objects.
But, if you use tableView, it perfectly reused already created views.So evenhough you have 1000+ comments, it just uses 5 UIView objects

Embedding a UIScrollView with a UITableView

So Path uses this type of page where there is a view above their customized looking table that is a background photo, which contains some user info among other things. I'm trying to recreate something very similar to this.
So lets say that I hypothetically wanted to make a view that shows exactly the way the Path app does, but instead of that weird customized version of a table view that they have, there is an actual table. How would I do something like this? The reason why I would need there to be another UIScrollView embedded into the view is because the entire thing needs the capability to scroll. I'm trying to be as detailed as possible, but its a little difficult to explain.
What I'm imagining is going to happen if I just tried it right now, is that I'd embed a UIView above a UITableView within a UIScrollView that's the size of the frame, and when I'd go to scroll, the user would only scroll the UITableView, and not the entire thing at once. Hopefully that helps convey my doubts.
Another possibility is that I'm totally over thinking this, and I can simply just subclass a view in the header of a UITableView and it would stretch the width and height that I'd like. Hopefully this is the way as this would be easy!
Anyways, can anybody weigh in on this?
Path just uses a normal UITableView with UITableViewStyleGrouped.
The custom view at the top is the header of the first section of the table.
They also access the UIScrollViewDelegate method of the UITableView to change the look of the view (I think the image is moved) when the scroll view scrolls.
If you'd like a tableview that only scrolls within a part of the view and other stuff above it then you need to use a UIViewController. Then you can make it conform to UITableViewDelegate and UITableViewDatasource and add a UITableView and make the view controller the datasource and delegate.
Then you can also add a UIScrollView to it as well.

Multiple Visible Pages in Scroll Style UIPageViewController

So what I'm looking to do is have a UIPageViewController that will end up displaying three view controller vies, one fully visible and then two as previews to the right and left. An example would be the iOS6 App Store:
Is doing this using a UIPageViewController set to UIPageViewControllerTransitionStyleScroll possible?
Basically I'd ideally like to have is a case where I can have three UIViewControllers that I recycle as the user pages through the 1- items in the list (with n being at least 50). I know an interface that behaves like this can be done with a UIScrollView with paging enable, but re-using views would take some view shuffling code that I'd rather not write if Apple has already done it for me.
I'm totally comfortable with the fact that this is iOS6 only, by the way, and also comfortable with alternatives, if they exist.
Thanks!
Check the new collection view. I think you may be able to create something like that with reusing cell etc.

Resources