iso求助,CGRectMake坐标无效,只能控制长方形大小

这是AppDelegate里的代码,还定义了一个UIView类BNRHypnosister,里面只有一个实参CGRect

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; UIViewController *emptyView = [[UIViewController alloc] initWithNibName: nil bundle:nil ]; self. window .rootViewController = emptyView; CGRect firstFrame = CGRectMake(100.0f, 10.0f, 200, 300) BNRHypnosister *firstView = [[BNRHypnosister alloc] initWithFrame: firstFrame]; firstView.backgroundColor = [UIColor redColor]; [self.window addSubview: firstView]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible];

return YES;
}

![图片说明](https://img-ask.csdn.net/upload/201607/19/1468923933_367058.png)图片说明

代码看不清楚- -

另外没用过BNRHypnosister 。 但是我用UIview 是可以的

self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
UIViewController *emptyView = [[UIViewController alloc] initWithNibName: nil bundle:nil ];
self. window .rootViewController = emptyView;
CGRect firstFrame = CGRectMake(100.0f, 10.0f, 200, 300);
UIView *firstView = [[UIView alloc] initWithFrame: firstFrame];
firstView.backgroundColor = [UIColor redColor]; [self.window addSubview: firstView];
self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible];
return YES;
    ----

Copy你的代码 CGRect firstFrame = CGRectMake(100.0f, 10.0f, 200, 300); 这句代码后面少了;号

CGRectmake是针对于当前视图的视图来说的,windows本身默认就是全屏。你要看清楚相对滴,虽然我也不清楚你最根本的问题是什么图片说明