Вопрос

Could somebody explain me what i'm doing wrong in the code below? I try to pass data from the didSelectRowAtIndexPath method but in the SizeViewController productKey has still value of null

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

                [tableView deselectRowAtIndexPath:indexPath animated:YES];
                SizeViewController *sizeViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SizeView"];
                sizeViewController.title = [self.choosedProducts objectAtIndex:indexPath.row];
                sizeViewController.productKey  = [self.choosedProductsIds objectAtIndex:indexPath.row];
                [[self navigationController]pushViewController:sizeViewController animated:YES];

}

Это было полезно?

Решение

Can u try to get a reference to the storyboard instead of using the self.storyboard property? It is just a guess.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];

Also, can u verify in your solution that sizeViewController is not nil?

Другие советы

You are trying to load a view controller from storyboard,So it should be initialised as

SizeViewController* detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SizeViewController storyboard identifier"];
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top