jwknz
jwknz

Reputation: 6824

ios - check what the value is of a selected UITableViewCell

I need to find out what the value is of any given cell.textlabel.text within a UITableView.

The content is partly dynamic - I know what are all the possible variations are there to show which can be displayed , but I do not know when certain rows are being displayed or not.

For this reason if(indexPath.row == 1) will not do.

Is there someway to do something like if([indexPath.row isEqualToString:@""]) instead?

Upvotes: 1

Views: 60

Answers (1)

Grzegorz Krukowski
Grzegorz Krukowski

Reputation: 19802

To get a cell having indexPath - you do that:

UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
if([cell.textLabel.text isEqualToString:@""]) { }

Upvotes: 2

Related Questions