FreeForm ViewController - iOS

时间:2013-07-11 19:13:16

标签: ios

我在mainviewcontroller的顶部添加了另一个viewcontroller(freeform viewController),但不知何故,它没有显示完整大小。请查看下面的代码和截图。

- (void)viewDidLoad
{
    [super viewDidLoad];
    firstSurveyViewController = [[FirstSurveyViewController alloc] initWithNibName:@"FirstSurveyViewController" bundle:[NSBundle mainBundle]];

    CGRect rect = [firstSurveyViewController.view frame];
    rect.origin.x = 10;
    rect.origin.y = 20;
    [firstSurveyViewController.view  setFrame:rect];
    [self.view addSubview:firstSurveyViewController.view];
}

firstSurveyViewController

enter image description here

1 个答案:

答案 0 :(得分:0)

手动尝试除原点之外的宽度和高度设置。 rect之后CGRect rect = [firstSurveyViewController.view frame];的初始值是多少?

此外,通常,您不需要将viewControllers添加到其他viewControllers,除非您使用UINavigationControllerUIViewController Containment来管理它们。在这种情况下似乎firstSurveyViewController应该是firstSurveyViewUIView的子类。