我尝试将uiview从app delegate设置为另一个viewcontroller,在viewcontroller中我添加了一个IBOutlet属性,并且从app delegate我使用此代码:
self.secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
[view setBackgroundColor:[UIColor redColor]];
self.secondViewController.myView = view;
self.window.rootViewController = self.secondViewController;
[self.window makeKeyAndVisible];
但我的uiviewcontroller的视图不是红色,而是我从IB提供的默认颜色。
错误在哪里?