iOS tableView with time at the left - ios

I'm building an iOS app that would benefit from having the time from say 07:00 to 16:00 (specified by user) on the left of a UITableViewCell like this:
What would be the best approach for such a behaviour, including the possibility of a colored rectangle over several cells? I imagine you would design a custom cell but it's the colored rectangle (appointments in the iOS calendar) logic that I'm not sure how to go about as it stretches over several cells.
Could someone point me in the right direction, give any links or something to kick me off? Just an explanation of how one would go about this is helpful.
Thanks alot!
Erik

I think you need to look into UICollectionView, with provides powerful layout apis for this kind of problem than UITableView.
There are a lot to dig into though.
Some of these materials maybe helpful to you:
http://www.objc.io/issue-3/collection-view-layouts.html
https://github.com/erichoracek/MSCollectionViewCalendarLayout

Related

How can I add a tableViewCell within another TableViewCell?

I need to implement a cell inside of another cell, is it possible in any way? Or should I just find another way? thanks
Edit:
Sorry for the brief description, the problem here is that I've got a component thats a cell, and I want to include it in a tableview with some other icons and labels in the cell. Maybe the best solution here would be to include a tableview inside of the cells, with a unique cell in it, as someone suggested. I've tried to do it and it worked but when it came to launch another screen when selecting the cell it only worked on the margin where the inside tableview isn't included, how could this be solved?
something like this
Thanks!
Find another way. I don't know what exactly you want to do, but maybe modify the headerView for your section (kind of like a cell) and use the cells within that section as your sub-cells.
As it’s been stated above, I would strongly suggest finding another way. Without knowing more details about what exactly it is you’re trying to accomplish, it’s hard to give you another solution but I ran into something similar last year. It’s gets extremely messy and it does not scale well, especially when using a lot of dynamic data. Also, when using UIKit, I think there is a limitation of having a dynamic table cell inside another table cell, which limits your use cases dramatically. If you provide some more details on what it is you’re trying to accomplish, perhaps we can point you towards a better solution.

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 :)

Best way to display tabular data like the attached screenshot in Swift?

I am looking at the lower portion of this screenshot. If I had something similar to this in my design, what would be the best way to set this up in Swift?
I have looked into UITableView, but that doesn't seem to be quite what I need. Most of the tutorials & articles I've read regarding the UITableView only focus on 1 or 2 columns max, and don't really expand on how to go much beyond that.
I briefly considered just doing a bunch of statically placed labels, but realized that I will not always know exactly how many items are going to be in the table, so I need a more dynamic way of going about it.
Does anybody else have any advice on how I might go about achieving this sort of layout in Swift?
There are several ways...
UITableViewCell subsclass. It's perfect for your purposue, and you can design it's contents following your needs. (No matter if 2, 3 or 4 columns)
Combination of StackView Vertical with StackView Horizontal inside. Each horizaontal view will contains one of your row.
Generate a HTML page and injec it in a SFSafariViewController or WebView.
Static content. A plenty of UILabel. One for each piece of information
In my opinion the best aproach is the UITableViewCell subsclass.

Trouble with continuous scroll and pagination - Swift UICollectionView

This site is awesome.
So I need to create something that looks like this...
It needs to be continuous with a fixed number of UICollectionViewCells (8). It also needs to paginate really well and center the cell (as shown) when the user swipes left or right.
PROBLEM: 1. The pagination provided with UICollectionView doesn't center the view on the cell being shown. 2. I'm having a hard time finding the proper way to get the continuous effect.
Any help on this would be much appreciated. This is a tough one!

Implementing chat layout with UICollectionView with AutoLayout

Is what I'm trying to accomplish here even possible? I've been searching for hours for sample code and/or SO answers that demonstrate this simply enough to follow, but so far no luck.
Goal: implement something that looks roughly like this mock:
Yes, I know this is easy with a tableview, but the full design includes custom interactions, multiple columns, UIKit dynamics, and custom animations when adding/deleting cells, so UICollectionView is the better candidate. Until I can get this core layout to work, though, the rest of it is just a pipe dream.
So far I've started with a subclass of UICollectionViewCell that has a single label with constraints to all 4 sides of the content view. At which point I run into these issues:
It's unclear how I can calculate collectionViewContentSize() when the cells don't exist yet, esp. given that the majority of cells are actually offscreen most of the time!
If I just throw in an arbitrary content size (e.g., 320x1000), my views show up, but their heights don't adjust to the label content…I can't seem to read the cell height from within my UICollectionViewLayout subclass.
Seen or done anything like this? I'd include code, but after hours of futzing with it. I'm just looking for a clearer tutorial or sample code that fits this scenario.
There's a project you might want to look at. It's fairly involved and probably has a lot of code for situations that don't quite match yours, but does indeed create a chat view using a UICollectionView.
It can be found here:
https://github.com/jessesquires/JSQMessagesViewController
For item 1 - with regards to calculating collectionViewContentSize, I think you'll find you may not need to calculate that, at least as long as you're using a UICollectionViewFlowLayout subclass for the layout.
And for item 2 - rather than set a fixed 320x1000 take a look at the JSQMessagesCollectionViewFlowLayout.m for sizeItemAtIndexPath.
Sorry, this probably should have been a comment, but I lack the reputation to comment & so I made it an answer (doesn't that seem backwards? Ah well.)

Resources