Ios UIPageControl:在故事板中创建视图,将其作为子视图添加,更改标签';s文本

Ios UIPageControl:在故事板中创建视图,将其作为子视图添加,更改标签';s文本,ios,objective-c,xcode,storyboard,Ios,Objective C,Xcode,Storyboard,我遵循了本教程:用于设置UIPageControl。现在,正如您在教程中看到的,故事板中有3个视图。我想做的是: 因为我需要许多具有相同布局的视图(在图片中,它只是橙色的背景),所以我需要能够重用它们并更改其上的文本,或者创建一个按钮,等等 我可以添加如下视图: UIViewController *aViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"View1"]; [self

我遵循了本教程:用于设置UIPageControl。现在,正如您在教程中看到的,故事板中有3个视图。我想做的是:

因为我需要许多具有相同布局的视图(在图片中,它只是橙色的背景),所以我需要能够重用它们并更改其上的文本,或者创建一个按钮,等等

我可以添加如下视图:

    UIViewController *aViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"View1"];
    [self addChildViewController:aViewController];
    UIViewController *aViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"View1"];
    // Change the text label thats on the viewcontroller, put an image on the UIImage thats on it, etc...
    [self addChildViewController:aViewController]; // After all that, add it as a child
    //Now I want the same layout template, so I choose the "View1" again
   UIViewController *aViewController2 = [self.storyboard                         instantiateViewControllerWithIdentifier:@"View1"];
    // Again change the text label.
    [self addChildViewController:aViewController2]; // Add this new one too 
    // And so on
但是,如果我想更改视图上标签的文本,该怎么办

我在想这样的事情:

    UIViewController *aViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"View1"];
    [self addChildViewController:aViewController];
    UIViewController *aViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"View1"];
    // Change the text label thats on the viewcontroller, put an image on the UIImage thats on it, etc...
    [self addChildViewController:aViewController]; // After all that, add it as a child
    //Now I want the same layout template, so I choose the "View1" again
   UIViewController *aViewController2 = [self.storyboard                         instantiateViewControllerWithIdentifier:@"View1"];
    // Again change the text label.
    [self addChildViewController:aViewController2]; // Add this new one too 
    // And so on

在我的图片中,我复制了视图1,但我需要能够做到这一点是代码,而不是在故事板上,因为我需要超过100个视图

正如我在你的另一个问题中建议的那样。做一个for-loop…但是如何向aViewController添加内容呢?类似于[aViewController setTextLabel:“text”];无法正常工作因此,如果aViewController上有标签,我如何更改它?[aViewController.textLabel setText:@“您的文本”]和“.textLabel”,我从何处获取该标签?我在情节提要的视图上贴了一个标签。。。