I'm having problems with a , I guess, simple thing.
I have a (It is NOT a SplitViewController) ViewController with a TableView object in it.
I want that when the users click a row in a table, my label on the right side change appropriately.
My label (with the text "Nome do Vinho" on the right) that i want to change
@property (weak, nonatomic) IBOutlet UILabel *rotuloDetalhesLabel;
I populate the TableView with this code.
I create the objects on viewDidLoad method and put in a NSArray called "vinhos".
// Create object
Vinho *vinho1 = [Vinho new];
vinho1.rotulo = @"Adega de Borda Premium";
Vinho *vinho2 = [Vinho new];
vinho2.rotulo = @"Adega de Borda Premium 2";
// Populate the NSArray with the objects that I create before
vinhos = [NSArray arrayWithObjects: vinho1, vinho2, nil];
Populating the TableView
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Configura a Cell
static NSString *CellIdentifier = @"TableCell";
TableCell *cell = (TableCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[TableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
Vinho *vinho = [vinhos objectAtIndex:indexPath.row];
// rotuloLabel is the Label of the row
cell.rotuloLabel.text = vinho.rotulo;
return cell;
}
I guess that it is made on didSelectRowAtIndexPath method but I dont know how.
If I forget to post something important just tell me.