Creating an app similar to Facebook feed page - ios

I'm just wondering what's the best way to do a screen that looks pretty much like the feed view in the Facebook app. I guess the most obvious answer would be to use a UITableView but there are lot of challenges.
There are comments in every feed item and for that we will have to use another UITableView. And that means a UITableView sitting inside a UITableViewCell.
We can't re-use the cells as there are several different content types.
Determining the height of the cell is again a problem as that depends on the number of comments in a feed item.
I'm not planning to do an app that looks like Facebook but this is just a food for thought! I guess there is a better approach that using UITableView. What do you guys think ?

You can design this type of complex interfaces also with hard code but if the code is organised it will save you more time than taking the challenge of using UITableView.

Related

UITableViewController VS UICollectionView

I've read in some forums that UICollectionView is better than UITableViewController when displaying feeds, some like Twitter feed or Medium feed.
Is that true? And if it is why should we use Collections over tableViews?
Thanks for your pov
[Your question is a possible duplicate of this one here: When to use UICollectionView instead of UITableView? but I decided to give you a short overview here.]
That's kind of true. It always depends on your use case and UI. In the end you can also use a UICollectionView to build your Table. It's all just easier one way sometimes. And sometimes not possible with one of them.
This is how Apple would describe it:
UITableView Displays hierarchical lists of information and supports selection and editing of the information.
Apple Developer Documentation - UITableView
UICollectionView Manages an ordered collection of data items and presents them using customizable layouts.
(Apple Developer Documentation - UICollectionView)
To answer your question:
I would mostly use a UITableView because they do a great job in displaying lists of information. But if you see it's going to be more complex, use UICollectionView. There is a good YouTube video series on how to customize them to build a twitter news feed. It's a good example of how to use it and when to use it. Check it out
To sum up:
Use UICollectionView for more complex and advanced things where you need a lot of customization.
Use UICollectionView for things that are placed in a grid with for example three pictures in every row.
Use UITableView for simple and advanced lists but not necessarily if you need a feed like twitter uses (to point out an example).
Keep in mind that you can use custom cells (with or without XIB files) in a UITableView!
However just choose the way you are most comfortable with.

What is the best way to make a data grid in swift?

example
Good evening everyone!
Part of my requirements for the app I am building has me creating a data grid similar to the example linked. I have spent the entire day searching google and this site in order to find the best way to get started in swift. I have read so far that both a table view and a collection view could work, but that a collection view is preferred. My data grid doesn't necessarily have to be scrollable but the data does need to be editable. I don't have much experience using either tableviews or collectionviews and I'm looking for the simplest implementation without relying on a third party dependency. Any help or direction is greatly appreciated.
Since I don't know your experience level, I will explain at a basic level - my apologies in advance if it's too basic :) A UITableView displays rows of data, while a UICollectionView displays cells in a grid.
So, at first, a UICollectionView might appear to be the better option. But as always, things get complicated pretty quickly :) For example, are you going to implement your UICollectionView as one cell for the whole row, or are you going to implement a cell per column in your table of data? And if you implement cells per column of data, how are you going to handle the different types of cells you might (or might not) need for each column?
There are multiple decisions that might need to be made, and only you know the answers to a lot of these :)
But the simpler option probably is to go with UITableView and that's what I'd suggest if you are new to both UITableViews and UICollectionView. Try out a UITableView-based approach first and if that doesn't work, or you see limitations, then try a UICollectionView. The experience you had in building the UITableView will help you in moving on to UICollectionView anyway :)

IOS: Best way to show long articles with multiple images

I want to create an app for a news agency. The app has to display long articles with images/yotube videos like the news agencies website.
The article will come in json format from the api.
What is the best ways to do this so that the app looks and feels like the website.
NOTE: Cant use webViews so the options left are UITextField,UITextView for article inside a Table View or Scroll View?
What would be the best implementation?
Example URL For Article
I would use a UITableView or a UICollectionView.
I second dasdom......so that the view doesn't get boring (ie. the same style of cell all the way through) create 2-3 different reusable cells and call these to display different media.
I would suggest Use a Table view with show more and show less article content functionality with some kind of animation can be the best implementation for this.

Parse PFTableViewController vs regular UITableView with PFObject as data source

I am new to iOS development, and I have been doing a fair amount of research. Unfortunately, as the title of my post suggests, neither possibility seems exactly suited to my needs.
I need a lot of customization with respect to the look and feel of each individual table view cell, and I need for my table to have header sections which are clickable. I would actually like for the section headers to have the drill down quality and not the cells beneath each section header.
To my knowledge, the problem with PFTableViewController is that it doesn't easily allow for multiple sections (even less so if I need for these section headers to be clickable and of a different look and feel from the regular cells.) Furthermore, customizing the PFTableViewCells doesn't seem terribly simple either.
However, if I use the regular UITableView even with Parse as my backend, won't I run into some difficulties with respect to loading, pagination, etc...?
I have a pretty good idea of how I would implement this app with regular UITableViews so I guess here is my question: is it worth it for me to try and figure out all of this PFTableViewController stuff?
I should also mention the fact that my table view controller will not take up the entire view but only half of the screen.
Thanks in advance for any and all advice
It seems that a normal UITableView will suit your needs. If you want to customize the look and feel of individual cells, you can just subclass a UITableViewCell and modify it.
In terms of your needs with the headers, it's hard to say without knowing more about your app, but you want to follow standard user interface conventions. Users don't expect headers to be clickable. Instead, they attempt to traverse information hierarchies by selecting table view cells, which then bring them to new views with more information. Based on your, needs I think that a standard table view controller with some customization is what you want.

Objective C: How to implement a datagrid view (tables with multiple columns)

I am currently working on an iPad application that uses a table view to present data, I was inspired by the iTunes application in iPad that present it's data in multiple columns in a very nice and neat manner, and the most interesting thing is that during the portrait mode the itunes application displays data in 2 columns but when the user switches to landscape mode, it switches the display to 3 columns (since there are plenty of space to display data horizontally).
This is what i'm talking about:
but i found out that iOS SDK only supports single column for tableview (it would be nice to utilize the entire space provided on iPad screen to present data), i did some research and i found out that the best way to present data in multiple columns yet like spreadsheet style is to use datagridview instead, but iOS SDK did not provide any data grid view controls for iOS developers.
I found out over the internet some customized tables like:
AQGridView.
DTGridView.
and also the one from this:
http://usxue.is-programmer.com/posts/14176.html
and the one from this:
http://xebee.xebia.in/2011/04/14/building-editable-gridview-for-iphone-apps/
But sadly none of these ever met the requirements of the application i was working on.
Could you guys provide me some ideas or share some sample codes or links on how to display data in somehow-data grid view, to achieve similar effect used in iTunes application (as shown above).. Any form of help would be pretty much appreciated. Thank you guys!
The summary answer is, place multiple data "views" across in a single cell.
The more detailed answer:
Create custom views that represent the single cells you want. You can for this purpose make them resizable enough to work two across or three across (they will get loaded into 1/2 or 1/3 of the cells bounds).
Then make a custom UITableView cell, that can take two or three data items - load up an instance of the custom view previously created in the cell for each data item you have, placing them next to each other. You can have the cell do the view layout when groups of data items are added.
In the cellForRow code in the table delegate/datasource, you use your data source in groups of two or three (and report the row count accordingly) to pass along to the custom cell.
Sorry I can't share code, but I have used this technique before in other applications.
What's wrong with creating a UIView class to represent a single cell, and another that lays out an array of those cells in a grid? Put your grid view in a UIScrollView and you're about done.
UITableView is obviously a pretty complex class. Much of that is to make it very general, very reusable, and able to support a huge number of rows. Your class doesn't necessarily need to be that complicated -- if you have a fairly small number of cells, your "grid" could really just be a UIView in which you lay out cells in rows and columns. UITableView removes cells that aren't seen in order to save memory; you might need to do something similar if you have hundreds of cells, especially if they're large, but a few dozen probably won't require that.
In short, since you need a grid view for a particular use, you don't need to do all the extra work that would be required for a general, reusable solution.

Resources