Here is the problem: I have a table view, custom cells, and detail view. I have 10 rows in my table and when the user selects one of the rows, the detail view opens. How to set the detail view nav bar's title from the selected row of my table view? I have three classes - televisionList (my tableview), televisionCell (my cells in the table view) and televisionDetail (my detail view which opens when a row is selected). In my televisionCell I have declared the following label:
@property (weak, nonatomic) IBOutlet UILabel *tvLabel;
In my televisionList (the tableview) I have this method:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
televisionCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *objects = [[NSBundle mainBundle] loadNibNamed:@"televisionCell" owner:self options:nil];
for (id currentObject in objects)
{
if ([currentObject isKindOfClass:[UITableViewCell class]])
{
cell = (televisionCell *)currentObject;
break;
}
}
}
switch (indexPath.row)
{
case 0:
{
cell.imageView.image = bnt;
cell.tvLabel.text = @"БНТ 1";
cell.backgroundView.image = [UIImage imageNamed:@"lightbackgr.png"];
break;
}
case 1:
{
cell.imageView.image = btv;
cell.tvLabel.text = @"bTV";
cell.backgroundView.image = [UIImage imageNamed:@"background-cell.png"];
break;
}
case 2:
{
cell.imageView.image = novatv;
cell.tvLabel.text = @"Нова TV";
cell.backgroundView.image = [UIImage imageNamed:@"lightbackgr.png"];
break;
}
}
Now, I want to change my detail view title to be equal to cell.tvLabel.text when a row is selected. Where and how to do that? Thanks in advance!