How to achieve similar layout to 365 Scores app in Swift? (Screenshot included) - ios

I tried to achieve the below layout with a single tableviewbut failed.
The structure of the below screenshot is as follows:
Date (Today):
My subscribed lists (My Teams & Games):
League name:
Actual match (Looks like a Tableview cell)
Please note that each level of the structure is dynamic in count depending on the matches of the day.
I tried implementing this with a tableview but couldn't figure out how to create nested sections. For example, at the top level I tried to make the sections headerView to represent the date but then I was forced to make the rest of the strucure inside a cell which is not the case for the app in the screenshot.
I am assuming the actual matches are the tableview cells since they are the ones that are swipe-able?
Please help me with some ideas.
Thanks.

There are various ways to approach this... here are just two ideas:
As was mentioned in the comments on your other question - you really need to start working on it. If you run into specific problems, come back here with specific questions.

Related

How to create a dynamic drop down within a table view?

I need to create a tableview with at least two sections, transportation and hotel. Tapping on either one creates a drop down view showing info on 1 to n examples of the topic selected. You don't know in advance what data is going to be there so it has to be dynamic to present any number of results with some having lengthy descriptions below each example and some not. I've been racking my brain and I can't figure out how to do this. The dynamic nature of this makes it extra difficult. Here is a mock up of what it should look like: click here
Check out this Git-Repo. I am using it inside my app and its working quite well. You can also watch the tutorial for it: https://www.youtube.com/watch?v=22zu-OTS-3M&t=1s
Hope that helps!

Need some advice whether to use static stable view or dynamic table for my project

I am exploring the development of my first iPhone app (Xcode and Swift 3) and I need some direction and advice. I have a need of a multiple level expanding and collapsing table. I've attached some screens of a web app I developed to help you understand where I am going. In my app there are main level items, which expand to show sub items, which expand to show the contents of that item. And not every sub item (when expanded) has the same elements. Some sub items have simple text fields while other items have questions with yes and no answer options. I am so green I don't even know where to start with pulling this off in an app. I have worked through some tutorials on expanding and collapsing dynamic cells but I am unaware if that is the best way because not all of my sub cells contain the same contents. Should I use static cells instead? Or is there a way to create cell templates (like include files in php) and call them in to the table and populate them when I need them? I am lost and need some direction. Any help you can give me would be greatly appreciated. I would love tutorials as well. I have a Lynda.com account if you are aware of tutorials there I should follow. Thank you!
one of the simple layouts
a different layout
I think this lib could help you.

iOS - What are best practices for view controller setup for a posts + comments data model?

Forgive me if this question has been asked elsewhere, I was having trouble finding similar questions.
So I have an app where I am displaying a list of posts, and each post has a list of comments, very similar to the way Instagram's home page is laid out.
Current implementation
The way I've implemented it, I'm using a single UITableViewController and I have an array of posts that back my data source. Each post object has it's own array of comment objects. In numberOfRowsInSection I iterate through the posts array and add up all the posts and comments to get the total number of rows. I have two UITableViewCell templates, one for posts and one for comments, and in cellForRowAtIndexPath and estimatedHeightForRowAtIndexPath (and really any function that does anything significant) I have to do a bunch of logic just to get the right model or view for the given index path.
Issues
This setup seems to work okay, but is really difficult to debug and add features to. Especially now that I am trying to implement Pusher updates from the server, I am running into a lot of issues with how complicated the model to view relationship is and how long it takes to update the model before the view can be updated.
Alternative Implementations I've considered
I started reading a little about UICollectonViews and was thinking about using the supplementary views to show comments and having only the posts be regular cells, but I'm not sure if that's actually how collection views work or if it would make this any easier. I've also considered using only one cell template for the post + comments that dynamically adds comment views to itself as necessary, but I'm not even sure that's possible.
Question
Is there an easier way to implement a posts+comments layout that is better suited to the way the data is laid out? This seems like a pretty common problem that's been solved by a lot of people so I'm hoping someone can point me to some best practices.
Edit: An example of what I mean. The part outlined in red is the comment section for the post, outlined in blue. Instagram seems to be making each post a section though, with the poster's name as a floating header, each post being it's own section seems like it would be easier to implement. I had initially tried to implement my app that way but ran into issues with making the section header much larger than default, maybe I should just change my design to better suit sections?
I guess your main problem is that you are using different cells for "sub entities". So each time you have to reload multiple cells when updating one entity.
It doesn't really make a difference whether you chose the table or collection view. (Depending on the layout, but I guess Instagram is a table view too)
To make your view handling better / easier you should create a cell that handles all the properties of your entity. And for showing all comments you should probably switch to a new view controller. Or you could use one section for one post. So you could just reload one section. The post could be the section header and the comments the cells in the section.
So you could access your cells easily. tableData[section].commments[row]. And then you could just insert a new row into the section when a comment is added.
I hope I understood your problem.

Want to achieve this kind of functionality in iphone app

I am having an app in which I want my view to be loaded like shown in the screen shot below.
The following view contains page control to show multiple images,buttons,labels,resizable text view and resizable text field in a single cell of table view.
There will be number of rows in a table view and rows will be generated dynamically.
Is there any cocoa control or tool which can give me functionality like this?
I have searched on cocoa control and goggled it a lot but couldn't find any matches to achieve this.
I thought of taking different views with sub viewing it didn't get much idea of how to generate it dynamically.
Please help me if someone has achieved this kind of functionality in any of their projects.
Thanks in advance.
Hint :
Divide each items in cells for single section, that means, one section for one item.
for e.g.
User photo, User name, User location and Post time in one cell.
Image gallery in another cell with page control on it.
Favourite (liked) post, comment on post and price in individual cells.
what you've to do is, create and add each item in a cell. While you're giving the height of each cell using delegate, check for conditions for which you're assigning the height. For e.g. if you've likes for the post (favourite) then only give height for that cell otherwise pass 0 (zero). Do the same for everything or as per your requirement.
For comments, you've to calculate text height, and based on that, you'll need to set height for comment cell.
References:
Here's a nice tutorial for this (not exactly) stuff. Rebuilding Instagram Feed Table View. I also googled a lot and found this, https://www.cocoacontrols.com/controls/stxdynamictableview, you may also need https://www.cocoacontrols.com/controls/mhpagingscrollview for showing image gallery.
P.S. This is not a "lunch plate" of course you've to make it for your self. Get hands on the keyboard! :)
Good luck!

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