I'm new to storyboards and I'm having a problem with custom initialization.
Before using storyboards I used to do this to push a view controller from a table which has a custom initialization:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Creating Dummy Hotel
HotelItem *hotel = [[HotelItem alloc] init];
HotelDetailViewController *controller = [HotelDetailViewController controllerWithHotel:hotel];
controller.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:controller animated:YES];
[hotel release];
}
Now with storyboards I'm using prepareForSegue instead of didSelectRowAtIndexPath which turned into this:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
//Creating Dummy Hotel
HotelItem *hotel = [[HotelItem alloc] init];
hotel.name = @"Hotelucho";
// Make sure we're referring to the correct segue
if ([[segue identifier] isEqualToString:@"ShowSelectedHotel"]) {
HotelDetailViewController *controller = [segue destinationViewController];
}
}
I know that I can change my private variable "hotel" and set the property right after the [segue destinationViewController] but I find more useful to call my custom init method.
Is there a way to achieve this?