无法访问 childviewcontroller 中的 uitextfield

Cant access uitextfield in childviewcontroller

子视图

@interface GenWarnDangerVC : UIViewController <UITextViewDelegate>
@property (weak, nonatomic) IBOutlet UITextView *riddorText;

在父级中我想访问 UITextView 但不能完全理解语法

NSString* tempString = self.currentChildController.view.riddorText;
NSString* tempString = self.currentChildController.riddorText;
NSString* tempString = self.childViewControllers[0].riddorText;
etc

设置如下

[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"ChildFour"]];

GenWarnDangerVC * GenWarnDanger_vc = [self.storyboard instantiateViewControllerWithIdentifier:@"ChildOne"];
[self addChildViewController:GenWarnDanger_vc];
GenWarnDanger_vc.delegate = self;

self.currentChildController = self.childViewControllers[0];


self.currentChildController.view.frame = self.containerView.bounds;
[self.containerView addSubview:self.currentChildController.view];

如果考虑到可能的可扩展性and/or可重用性,这里是访问向上转换的特定子控制器的安全方法

if ([self.currentChildController isKindOfClass:GenWarnDangerVC.class]) 
{
    GenWarnDangerVC *controller = (GenWarnDangerVC *)self.currentChildController;

    // << do anything with "controller" directly access properties & methods 

    // for example
    controller.riddorText.text = @"New text";
}