I have a UITableView with two sections. Each section has a few UITableViewCells. I'd like to put a UIButton between the first section and the second section. Should the button be in it's own section? or perhaps in the third cell of the first section?
Edit #1: perhaps it's easiest to just use add another section with a single cell and style it like a button?
Well, that depends on how it's set up and how you want it to look. If you're in a plain table, I think it shouldn't really matter because there's no space between sections. If you're using a grouped table, it's probably easiest and best-looking to put the button in its own section.
You can put it in either its own section or in a cell. How you display the button visually (and its semantic meaning) might affect your choice.
Related
How to design and code this in swift(IOS) AND Xcode.If we tap on down button it should display items and vice-versa like this:
You need a Collapsable TableView. In order to achieve that, in your TableView you must keep track of which sections are collapsed (contracted) and which of them are expanded. For this you need to maintain a set of indices of sections that are expanded, or a boolean array where the value of each index indicates if the corresponding section is expanded or not. Check for the values at the specific index while assigning height to a certain row. Check this link for more help.
Refer ans by #Cristik.Refer my previous ans for more info.
You need expandable table view. Basically, you need to control the open and close of sections of your table view.
Here is an good example with working code & animation written in swift 3.0
I have three cells in my tableview which is standard tableview not custom cell. However, I would like the last cell to be editable, in other words I want that cell to get user input, something like textfield, but other cells just static and not editable.
I know how to make custom cell and make it work, but before I dive into that option I would like to know is there a tweak that I could use.
I wonder it is possible without making all tableview in custom cell?
You can use UITableViewHeaderFooterView instead of last cell. I think it is better way to add some UI into TableView.
You just need to override a method which is here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/index.html#//apple_ref/doc/uid/TP40006942-CH3-SW22
There is a simple example here:
http://www.ioscreator.com/tutorials/customizing-headers-footers-table-view-ios7
I hope that is helpful for you.
I just want to know what components to make this multiple and separated box like you can see here below, of course with each row can be tapped so that it can show something on next screen. thank you.
This is simply a UITableView with multiple sections. You will have to configure your dataSource to specify the number of sections in – numberOfSectionsInTableView:. – tableView:cellForRowAtIndexPath: and – tableView:numberOfRowsInSection: will also have to properly handle your data/UI structure.
As mentioned by rmaddy in the comments below, the tableview in your image has its style property set to UITableViewStyleGrouped.
I am using a UITableViewController with a plain style. I like how the cells expand to the edges of thew view, but I hate how the section titles stick to the top.
Is there a way to have section titles behave similar to how a grouped listing works?
What about using grouped style but removing the left and right margins. Possible?
I think this question might answer you. One awkward way of achieving this is not using the UITableView sections and draw cells instead with your a custom design.
You could always create a custom cell with the appearance of a section header. That's what I've done in the past to for these kinds of scenarios, that way it won't stick to the top of the view. This of course requires additional logic such as disabling section headers and and using your new custom section header as a single celled section in your table view, if you catch my drift. It's actually not that hard and gives you good flexibility.
I am using a grouped table view to display items on a view controller.
I want anchor the section's title just like it happens with the plani styled table.
How could I do that?
Ah, I know what you mean, my answer is no, you don't think you will be able to do that in a simple way. You might be able to do that with some workarounds using custom UITableViewCells and custom UIView's as the section's titles. I guess that way you could achieve that.