Possible ways to do like UITableView Design with multiple columns.? - ios

I have gone through many of sites. But I didn't get the way to achieve it .
As so far , I came to know that using UITableView we need to make custom cell with some stuff of code and lots of stuffs on some custom design like GridView etc
https://github.com/tanin47/UIGridView [Here it is ok to modify but I'm actually looking for within 1 class file].
.
Here is actually I need to look to do design as like below image .
Here, I have done so far by using THIS LINK. but it is not useful for me.
if anyone knows please share your thought , any help or suggestion should be appreciable.

You can create a your own Custom UITableViewCell and design it in such a way it contains multiple UIButtons arranged Horizontally and seperated by seperators image . Here each UIButton will be representing a seperate column and also different selector methods must be added as target for different buttons within the cell . The UIButtons that are vertically aligned in different rows must have the similar Selector. In order to differentiate between buttons you can set their tag as the indexPath.row for the respective row .
I hope this might solve your problem :)

If you are looking for a grid like view you could very well use a UICollectionView and do some tweaking with design.

Related

How i can use multiple nib files with multiple arrays?

I am creating my iOS app, and i during that , now i have to build scrollable screen where there is image view, labels, collection view, Reviews etc (Prototype Image is attached). I am wondering is it possible to make that type of screen with UITable view using multiple Nib files? (If it is possible, kindly guide me as how i should use multiple Nib files with multiple arrays). And , if it is not possible, how else i can go for it? Kindly guide me, and sorry if thats a duplicate because i have searched but i was not able to find any good answer.
There are several approaches that you can do.
If you want to use UItableview, then you need to create multiple
UITableviewCells, where each cells is based on the section of the design. Then you can load it by using array, as you logic stated above. For example indexpath[0] you'll load the cell with the picture(lets call this pictureCell), then indexpath[1] you'll load descriptionCell, and so on.
The other approach is using Scrollview, with several UIViews on a vertical stackview. And then you'll create a UIView Subclass based on the section of the design. This is usually my go to solution.
I'm not sure what "array" is refering to here, but by the look of your screenshot, I would go with a StackView inside a UIScrollView, or something like that. No need for a UITableView if you don't have a repeting pattern, you can just stack multiple views in a scroll view.
I hope it's clear enough.

TableView with bar to change content on top, how to build it?

I have to build a tableView with a top bar "slider" like the one in the youtube app in the picture below.
I just wanted to ask if it's better to:
Use just one tableView and switch the content by changing some switches in the delegates methods and reloading all the rows
or
Use two tableViews and hide the one that's not displayed
If none of the two methods above is the best one please point me in the right direction, thank you.
Option 1 :
Take a UISegmentView on the top and have a single UITableView. Change the content of UITableView on valueChange event of segment.
Option 2 :
Have look at this awesome library by Yalantis - Segmentio. I have myself used this on couple of occasions. Handy when you have to horizontally scroll the segments (exactly what you need in your case). You can have a single UITableView for this as well.
Option 3 :
Check out another useful library by Yalantis - Persei. Just hard scroll the table to see these options. Again, single UITableView.
In all, the best solution, in my opinion is to have a single UITableView. Working with multiple tableView might seem a clean way for a start, but trust me, maintainability is the key and having a single UITableView would be a better approach.

How to work with dynamic content

I am working with a UITable View and I am trying to figure out the best way to handle the way I display the content as its dynamic.
For instance some of the things I search may have a title and a description but then other times only have a title.
In a n instance like this I would like to be able to control the positioning of the labels in my UITableCell, of which I have created a custom one.
For instance this is a graphical view of what I am trying to do.
Title:
No Title:
As you can see with the second option I have decided to move the UILabel to the left where the Title label would be.
So What would be the best way of doing this?
I am thinking maybe creating several different format types in a .xib and then just using if statments.. if its missing such and such then use cell a or b or c.
Or is there a better way to achieve this?
Any help or advice would be greatly appreciated.
The different formats in .xib files will do the trick, just instance the proper cell type according to your needs, the other is delving into how you draw your cells, adding labels as you see fit when you get your data and drawing them appropriately.

iOS static table in a view?

Sorry if this is a really silly question but I'm new to iOS. I'm trying to do this:
The table cells are static as the content shouldn't change (the options are the same all the time). I also need to place the submit and cancel buttons below and replace the red background with an image.
My problem is, I get the error saying:
static table views are only valid when embedded in uitableviewcontroller
So my question is, how would I embed a table inside my view, like any other element?
Thanks in advance for any help :)
There are two relatively simple options to build a screen like that:
Make your controller a `UITableViewController, add two sections to the bottom of your static part, and put custom cells with buttons into these two sections, or
Define the static content of your table in code.
The look of your screen will change slightly for option 1, but it is important only when you have many cells, forcing the sections with buttons off the screen until the user scrolls.
The second option requires writing some code, but not too much to cause you too much inconvenience.

Can I use more than one custom tableviewcell nib file in a UITableView?

I want to put different cells in a table, and all of them is kind of complexity, so I want to use nib for these cells. However, i really don't know how to use multiple cells in a table. Can you help me?
You can use as many custom UITableViewCells as you want in a single UITableView. The issue here is: What kind of logic do you want to implement? Only you can define it. You can start by using this tutorial to see how to implement the custom UITableViewCells:
http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html
You can then reply to my answer to tell me what logic do you to implement. For example:
first 3 cells one with a type of UITableViewCell, then 3 with different UITableViewCell.
Alternate between cells (for instance, 4 different UITableViewCells in a row)
You need to specify what you need. :)

Resources