I\'m starting now with Xcode on 4.2 for iOS5 and there are a few changes and I\'m now crossing a problem that I can\'t figure out a way to solve it.
I\'m doing an ex
Like @陳仁乾 and @Marco explained was completely correct. To make everything a little bit easier I would recommend you to use a single NSArray
which will be initialized when viewDidLoad
. Just name the segues the same as your UIViewControllers
, this way you can Display a correct description of what UIViewControllers
you can choose from and you can also perform the segues
from this NSArray
:
(Actually I'm not sure if it can cause any problems calling the segue the same as the UIViewController
you want to call. Please let me know if this is BadPractise)
viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
_arraySessions = [[NSArray alloc] initWithObjects:
@"MyViewControllerName", nil];
}
cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:@"overviewCell"
forIndexPath:indexPath];
[cell.textLabel setText:_arraySessions[indexPath.row]];
return cell;
}
didSelectRowAtIndexPath
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSegueWithIdentifier:_arraySessions[indexPath.row]
sender:self];
}