这是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;
}然后无论我怎样修改坐标,长方形始终在屏幕左上角,我搞了一下午了,弄不出来,求帮忙,aotolayout也关了,没用
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;
}然后无论我怎样修改坐标,长方形始终在屏幕左上角,我搞了一下午了,弄不出来,求帮忙,aotolayout也关了,没用
解决方案 »
- ipad开发 UITableView的section headerTitle问题
- 教育门户网站外包Android平台以及Iphone平台手机软件
- 如何下载sample code,例如CrashLanding?
- uitextfield 不显示leftview
- 在XP下用虚拟机开发iphone软件可以发布到APP STORE吗?
- 导航栏隐藏展开效果
- iOS textField的水印文字设置大小
- appium做ios的自动测试,环境一定要在苹果电脑上搭建吗?
- gcdasyncsocket-server-receive-data-only-first-time
- cell选中问题
- 关于ShareSDK第三方登录
- MJRefresh下拉刷新相关
self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
UIViewController *emptyView = [[UIViewController alloc] initWithNibName: nil bundle:nil ];
self. window .rootViewController = emptyView;
CGRect firstFrame = CGRectMake(200.0f, 100.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;
}
没有问题啊