Menu
  • HOME
  • TAGS

Find out UITableViewCells with detailTextLabel [closed]

uitableview,text,swift,xcode6,detailtextlabel

You should not do this. Neither in Swift nor in any other language. You should query the dataSource because that is where the true state is stored. If you scroll a cell offscreen it get's reused, and the text gets set to something else. You can't rely on that information....

How do I show a hidden subtitle in a UITableView when selected?

uitableview,swift,subtitle,detailtextlabel

Just use the didSelectRowAtIndexPath method and access the touched cell. Then you can show the detailTextLabel. override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { var cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellID) as UITableViewCell cell.detailTextLabel?.hidden = false } ...

UITableViewCell's detailTextLabel not use all the available space

ios,uitableview,detailtextlabel

I'd recommend you to subclass a UITableViewCell and put all your cell customization in it. It could look similar to this code: CustomCell.h @interface CustomCell : UITableViewCell - (id)initWithReuseIdentifier:(NSString *)reuseIdentifier; @end CustomCell.m #import "CustomCell.h" @implementation CustomCell - (id)initWithReuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier]; if (self) { // Customization...

UITableViewCell not showing detailTextLabel.text - Swift

uitableview,swift,detailtextlabel

Same issue here (from what I've read, perhaps a bug in iOS 8?), this is how we worked around it: Delete the prototype cell from your storyboard Remove this line: var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell Replace with these lines of code: let cellIdentifier = "Cell" var cell...

Swift UITableView didSelectRowAtIndexPath bug

uitableview,swift,didselectrowatindexpath,detailtextlabel

UITableView reuses its cells. So the cell for row a row you clicked on (unhidden the subtitle) may be used for row another row. The solution is to define prepareForReuse() method in the UITableViewCell subclass (or make the subclass if you do not have one) and hide the subtitle again...

Trouble adding buttons to UITableViewCell in Swift

uitableview,swift,detailtextlabel

The problem is that the only prototype cell style you can modify in Xcode is a Custom style. Make that setting in the cell's Attributes inspector and all will be well. I made a little screencast that demonstrates: http://youtu.be/bN-nBOgFL00 Note that there are two different things about a cell that...

App crashes if setting detailTextLabel of UITableViewCell

ios,uitableview,swift,detailtextlabel

Use: let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell Also, there is no need to force unwrap it. Even if detailTextLabel exists, I would use cell.detailTextLabel?.text = "Date" to be safe and make sure your cell is a style that supports detailTextLabel. Ie. Detail Left, Detail Right, Subtitle....

Add label text in detailTextLabel as well as text pulled from JSON

ios,objective-c,detailtextlabel

NSString *listeners = [NSString stringWithFormat:@"Listeners: %i", [[artist valueForKey:@"listeners"] description]]; cell.detailTextLabel.text = listeners; ...