Modify UITableView style after first display - ios

I have a tableView and after a flip animation I want modify the tableView style programmatically from grouped to plain, is it possible, if yes how?
Thanks

You cant just change the style of a UITableView after its been created, therefore you should probably release your old table view and recreate a new one with the style that you want...

Related

What controls does the built-in contacts app use?

In iOS, the built-in contacts app looks similar to what's displayed on this example page. What controls are being used to create the initial view? Is it a table view? If so, how is the image on the left offset from the two rows?
What's happening behind the scenes to switch this view into edit mode? Are labels being replaced with textboxes or are the textboxes simply being set to editable?
There are 2 ways to do things like this that I know
#1. That is UI TableView, but TableView with a custom TableView Header.
Also it is UITableViewStyleGrouped
Just Init and setup the view include a UIImageView On the left side and three UITextField on the right side.
like this
|----------| |---TextField---|
|---Image--| |---TextField---|
|----------| |---TextField---|
and set this view with:
self.tableview.headerView = yourViewWithImageAndTextField;
2. Just try to use Apple's own ABPersonViewController
Apple's sample
Documentation
Good luck to you
This looks like an pre iOS7 UITableView in UITableViewStyleGrouped style, and a probably a custom cell to handle the image.

How to make my own UIPickerView?

Since UIPickerView can't be customized to the level I want (without taking a risk by hiding specific subviews), I need to roll my own to select a time.
I figure I can do this using two UITableViews, but I'm unsure of how to do 2 things:
1) How do I determine which cell is in the middle of the view (i.e. which one did the user select)?
2) How do I make the table snap to the cell nearest to the middle of the view once the user has stopped scrolling?
Thanks for your help.
Why do you say that UIPickerView can't be customized?. It has a bunch of delegate methods made to allow a lot of customization, such as view for rows, height for rows etc etc..
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPickerViewDelegate_Protocol/Reference/UIPickerViewDelegate.html
Implement the delegate in your ViewController and customize it as you want.
You're just trying to select a time? Then use UIDatePicker. It is a picker view for time/date.
Depending on the type of customisation that you want, you might not need to make your own UIPickerView. You can return your own views for each component using UIPickerViewDelegate. Check pickerView:viewForRow:forComponent:reusingView:
The free Sensible TableView framework has a UITableView based date picker that you could use out of the box. Should save you a lot of time as it handles all the scrolling and table view resizing. Hope this helps.

iOS Keeping section titles anchored in Grouped Table Style

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.

edit the text of a cell?

I have a UITableView, and want to let users edit the text of a cell. I want to popup a new UIView to let them enter some text in textfield, then dismiss the view and replace the cell's label text. Is it possible?
This is kind of an advanced move, Vikas. The programming of and user interaction with table view cells is tricky. The reason is that the UI code is a bit tricky because of the scrollable view, and you have to be prepared for the table cells to move or change if the table data is reloaded.
Is there another way you can achieve the result you're looking for? Could you design your table view so that when a cell is selected, you push a new view onto the navigation stack, and have UI components on that view that enable the user to edit the value?
This is the way that Apple does the Settings on iOS. When you select a row, you are shown a new view that has appropriate editing or selection controls.
You should use the textLabel property.

UISearchDisplayController - I want a grouped table

I added a UISearchDisplayController using the interface builder in XCode 4.2, and it added a UITableView automatically.
The problem is that i want it to be grouped table, but i couldn't find how to change it.
Got any ideas?
Well you can't change it.
If you want to use a grouped table, forgo the UISearchDisplayController and use a combination of UISearchBar and new UITableView instance. You can create this table view programmatically or using Interface Builder.
Either ways attach it to a searchTableView property and keep it off the view hierarchy. When the search begins, attach it to the view hierarchy and lay it over the original table view.
This will involve a good deal of additional work but if you want it a grouped search table, this is the way to go.

Resources