//ViewController1 #import "ViewController.h" #import "AppDelegate.h" @implementation ViewController -(void)viewDidLoad{ [super viewDidLoad]; UIView* v1 = [[UIView alloc]initWithFrame:CGRectMake(113, 111, 132, 194)]; v1.backgroundColor = [UIColor colorWithRed:1 green:.4 blue:1 alpha:1]; [self.window.ViewController.view addSubview: v1]; } @end
ViewController.h #import <UIKit/UIKit.h> #import "AppDelegate.h" @interface ViewController : UIViewController @end
//appDelegate.h #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate>{ } @property (strong, nonatomic) UIWindow *window; @end
このようにiOS開発しているのですが
[self.window.ViewController.view addSubview: v1];
だとエラーが出ます
self.viewにすれば済む話ですが
このままの形で表示させたいのですが
どうすればいいのでしょうか?
初歩的な質問ですがお願いします
あなたの回答
tips
プレビュー