Change selection / highlight color of static uitableview - objective-c

How can I change the selection / highlight color of a static UITableView? I understand for non-static UITableViews I might just subclass a UITableViewCell, but since I can't use cellForRowAtIndexPath with a static UITableView what should I do?

When using static cells from storyboard, you can customize each cell dynamically in tableView:willDisplayCell:forRowAtIndexPath:.

You can customise each cell in Interface Builder. You can set each cell's attributes by selecting it and then editing the appropriate fields in the attributes editors. For even more customised appearance/behaviour, you can even subclass a cell and let Interface Builder of its class in the identity inspector.

Related

How to set a static UITableview on xib?

I want to use the xib to setup a static UITableview.
How can do to get it?
I don't find the button to set tableView static or dynamic.
How about use the storyboard?
It isn't possible with xibs. If you want to use static cells in your UITableView, you'll have to use storyboard.
Go to tableView properties and change Content to Static Cells, look at this tutorial

UITableViewController and custom UITableViewCell

Have couple of questions
When I place a UITableViewController on the storyboard, and wish to work with static cells must I create a class deriving from UITableViewController or can I only create a class deriving from UITableViewCell for the custom cell?
I created a custom UITableViewCell placed number of controls on it and tried dragging with control pressed to create an outlet but couldn't, any ideas why?
If I wish each cell to have different controls and behavior can I set each cell a different custom UITableViewCell and if so how does the UITableViewController initialize it? do I need to load it programmatically?
1) The cell must be a subclass of UITableViewCell.
2) No, I don't know why that didn't work, it should. Where were you trying to make the connection to? The cell or the table view controller?
3) Yes, I think this is the best way to do it. Have a different custom cell class for each different kind of cell, and make IBOutlets from the custom cell to its controls. Then just make one IBOutlet from the table view controller to the cell itself (you can then refer to the controls with something like self.cellType1.label1 ...). You don't need to do anything to initialize the cells if they're made in the storyboard.

iPhone iOS UILabel how to customize text color for UITableView detail text labels only?

I'm working on an interface prototype and am using a storyboard to do so. Part of the prototype involves setting the detail UILabel for UITableView cells to a certain color. I would like to avoid having to manually recolor every label within a storyboard.
I found that I can use:
[[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil]
setTextColor:[UIColor cyanColor]];
To change the appearance of labels within tableview cells. Is there a way to further refine this code to only apply to detail tableview labels? Currently it changes both textLabel and detailTextLabel of UITableViewCell.
Thank you!
You could trick around this by subclassing the cells in the detail view, then use
[[UILabel appearanceWhenContainedIn:[YOUR_UITableViewCell class], nil]
setTextColor:[UIColor other_colr]];
If you want to keep using the appearance proxy, you will have to create a custom table view cell and a new label.
In the storyboard editor you set the style property of your UITableCell to "custom".
Drag two label to the table view cell and configure it like you want it.
Create a new class that inherits from UITableViewCell and make IBOutlets for every label.
In the storyboard editor you set the class of the table view cell to the table view cell class you just created. Connect the outlets to the labels. Actually this is enough, because you can configure the appearance of the cells in the storyboard as well. If you want to configure the label through code you have to execute the following steps as well.
Create a new class that inherits from UILabel and leave it as is.
Go back to the storyboard editor and select the detailtextlabel and change the class to the label class you just create.
If you want more information on how to create your own table view cells see Table View Programming Guide for IOS

Change UITextLabel of a UITableViewCell when pressed

i've done a feed reader with a UITableView structure, i would to change the UITextLabel TextColor after an user click on it (like reeader app)
could someone help me?
thank you,
devskip
If you're using a built-in table view cell style, all you have to do is set the highlightedTextColor of the cell's labels. Then, when the cell is highlighted, the labels will change color as appropriate.
If you're using a custom UITableViewCell subclass, you can still set the highlightedTextColor, but you must also override setHighlighted:animated: to update the highlighted property of any labels.

How to hide/show controls in UITableViewCell when it goes in/out of editing mode?

I have few custom controls (image views) added programmatically to table cell. I want to hide them when table view goes into editing mode and show them again when view gets out of editing mode.
I'm not using UITableViewCell subclasses, controls are added through tableView:cellForRowAtIndexPath: method.
When and where should I do the hide/show?
I'm wondering is this even possible without subclassing (where I could do this in layoutSubviews)...
I think you can set the hidden property on the uiimageview
This is not possible without subclass.
Int he subclass, override layoutSubviews method and then write the code to control the layout.