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];
}
你的意思是“不正确”是什么意思? – Matthias 2013-05-14 18:32:57
下面@samfisher的回答是正确的,同时检查你是否有这样的行'#import“SubviewViewController.h”;' – Nazir 2013-05-16 14:21:03