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.
Related
I'm working on an iOS project, writing in Swift. It's a social network app where people have profiles and they can post different type of content. There should be 9 type of posts/content:
Normal (text only) post
Images post
Gif post
Video post
Audio post
Quote post
Chat post
Poll post
Link post
My question is related to how should I display it on the feed. The feed obviously would be some type of a collection (I think I'll stick with UICollectionView) but should I create 1 type of a cell, add every single element that I might need to display each type of a content embedded into a UIStackView and if it's the database request returns nil for an object (i.e that particular post doesn't have video or an audio, a poll, etc - all it contains is just some images) then I'll hide those UIStackViews from the cell OR should I create a separate type of a cell and its xib file, depending on the the content type?
I feel like the latter would be easier, but I'm not how to that? Meaning, how should I check what type of a content is it? Imagine something like Twitter for example, you see many different type of content, how should you approach the cell creation and displaying them?
PS: Keep in mind that the users should be able to filter their content based on the content type (i.e display only images, only text, only audio, etc). How should I approach this?
IMHO, it is better to create separate cell for every content type and manipulate views in it as needed. It is clearer and simpler solution.
Better option is create the different cell for different posts/content, and use the model classes variable/enum for know which type of content is it. its easy for filtering and managing the all type of posts.
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.
I can't seem to get a simple answer to this anywhere. I have a Page View Controller and similar lay-outs for all of the other view-controllers.
This is working without problems if I have one view-controller per view, but it seems very inefficient given that all the lay-outs are the same.
I've seen tutorials like this, but not for Swift. Is it possible to use a single view controller for all the pages and just switch out the text or images? If so, can you please explain how this is done?
All you have to do is make each page link to the same viewController and then dynamically change the content on each page based on the page number associated with it. You could easily have some elements that were hidden or diabled on certain views.
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.
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.