0

サブビューにデータを渡すにはどうすればよいですか?


SubviewViewController.h:

@property (weak, nonatomic) IBOutlet UILabel *lblName;

TableViewController.m:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Load SubView    
    SubviewViewController *SVC = [self.storyboard instantiateViewControllerWithIdentifier:@"SubviewViewController"];

    SVC.lblName.text = @"TEST"; // It's not working properly.

    SVC.view.frame = CGRectMake(20, 60, SVC.view.frame.size.width, SVC.view.frame.size.height);
    [self addChildViewController: SVC];
    [SVC didMoveToParentViewController:self];
    [self.view addSubview:SVC.view];
}
4

1 に答える 1