table view with multiple columns - ios

i want to display name phone number and salary of a employee in an ipad in the form of table with multiple columns for that i take three table views and successfully displayed data in them . the table views are scrolling independently.but i want to implement if one table view is scrolled the second and third must be moved parallel. can any one please tell me how to implement that one....

If you want all your UITableViews dependants and scrolling at the same time, there is no reason to create multiple table view.
You can just create un custom UITableViewCell with the layout and style you want! This will be easier and will consume less resources.

find out position of cell in first table depending on that change position of cell in next table.
You can use following property of UITableView - – scrollToRowAtIndexPath:atScrollPosition:animated:

Related

Create event in hourly calendar in table view in Swift

I am trying to create a daily calendar, like the native Apple one, that allows you to add an event that takes up part of a row or multiple rows. What would be the best way to go about doing this? I already have a table view built that displays the times by creating a custom separator line in each cell.
Should I be trying to use CGRect and create multiple prototype cells for each 15 minute interval (events will only be as granular as 15 min most likely)? Or would you layer a CGRect on top of the table view in a certain position? Events will not overlap each other, which should hopefully take some complexity out, e.g., not having to deal with events/blocks that are half the width.
Ideally, a blank row or an event should both be selectable so that an event can be added or edited, respectively.
Add two separate prototype cells one for no event and one for added event. You will of course have the data source array with you (I assume), from which you can detect for event is present on selected row in did select row.
Or else add flag for the same to check if event is added on particular cell index.
P.S. You can use UITableViewAutomaticDimension property for managing height for cells.

Nested collection view in table view is better or multiple collection view

I have to showcase some image with a little information like title and subtitle which will be horizontally swipeable. Basically, it will be like Airbnb app which shows the category and elements in it with horizontal swipe. The only difference is that in my case number of category(row) is fixed, which is 2. DataSource is same for both rows. I have two approach first is using two CollectionView and second one is by using a TableView and nesting the CollectionView inside tableview cell. Googled and get only the implementation part for both approach not the comparison or use cases for the approach. So my question here is, which process should I follow and why?
1) Using nested Collection view will make the code complex.Generally used only when cannot be implementable using table view.
2) Table view is similar to collection view just that it can be scrollable vertical not horizontal. This make table view easy to implement.
3) In your case collection in table view will work great. Row is fixed in that case you can use static table view.

With IOS, is there a way of making a proper table with rows and columns?

I have been trying to find a way of creating a table, with rows and columns, for iOS. The UiTableView is basically a tree-structured list like this
Apple sample code, but because it's called a table view, it hijacks any attempt to search for a proper table.
There are a couple answers that suggest very clunky ways of doing it, like this SE Question, but it's quite old. Has the situation changed since this question was asked?
I've done this using UITableView by simply designing custom UITableViewCells that are segmented into columns. All the custom rows together certainly give the appearance of a multi-column table. When any of your data in a column or row updates, you re-render the tableView or have each row in charge of its own re-rendering (i.e. via an NSNotificationCenter message), and the whole experience for the user is as a multi-column table. If you setup your table's data as a separate row-column data model, it's pretty easy to get all the individual cells to go where they need to go with your custom UITableViewCell.
take a UITableView and on tableRow take 3 view of(width=1 and height=row height), each view ill be at equal distance from another one. and take label between these view at end it ill look like a table with rows and column

Swift custom cells layout TableView decision

I need to display a table with in my iPhone app:
neither the number of cells nor the contents are known at compile time, but only at run time.
Views for each cell may differ, one cell has textField and another may have some other view control.
Should I consider Static or prototype cells?
Should I consider tableViewController or viewController with tableview in it?
Any thing I need to consider before I start coding? Thanks in advance
For The issue of dynamic Number of cell at Run time, you can call reload data for table view at any time you have the data source ready.
Prototype Cells should be used with no problem.
Simple Table View will be sufficient for the task.
You have to make cell, either in code or in storyboard, for each type of cell you want, 1 table View can have multiple types of prototype cells, Just name them differently and then make the objects of only the specific cell of which the data is best suited.
It is not that difficult but do handle the data source with extreme care.
Should I consider Static or prototype cells?
If you know all possible subview combinations that your cells might need to display the data appropriately, and they are relatively few, make one prototype for each. for example:
One text field,
Two labels,
One image view and a label,
...etc.
Otherwise, just use the plain-vanilla UITableViewCell (no subclassing) and remove/add subviews at runtime when reusing them (that is, inside the method -tableView:cellForRowAtIndexPath:).
Should I consider tableViewController or viewController with tableview
in it?
The only reason I would choose UIViewController + UITableView over UITableViewController is if -for example- I needed the table view to only take up part of the main view's bounds/screen, and display some other subview in the remainder. Otherwise, you get so much "for free" with UITableViewController that there's just no point in implementing all of that from scratch.
You have to choose prototype cell, u can create different types of cell depending upon your requirement.Any think ok for u, u can create tableview controller or view controller.

How to display HTML-like table data on iPhone?

I have a set of data in a matrix which I would like to display in my iPhone app with all of the rows and columns intact. Everything I can find on the web dealing with "tables iPhone" gives me information on UITableView, which only lets you show a list of items to the user - not an actual table in the HTML sense. What's the best way on the iPhone to display an actual table of data to the user, with column & row headings and table cells?
The solution that I found was simply to use a UIWebView. Then I can build the HTML table dynamically and load it into the web view.
The UITableView class was specifically designed to only show one column at a time due to the small size of the screen. If the data of your application absolutely needs to be laid out in one big grid on one screen the right way to do it, would be to add each cell as a subview to a custom view. Then implement the layoutSubviews method on your custom view to lay out the frames of the subviews in the grid you want.

Resources