我对objective-c和iPhone的开发还不熟悉,但到目前为止,一切都进展顺利,直到我试着深入挖掘(不是太深入)。我的问题是,我无法使用不同方向的特定坐标初始化特定UIView子类。
旋转效果很好,但问题是应用程序初始化的时间。我在考虑为不同的方向提供不同的布局。
这三个视图是在项目的nib上创建的,并为它们编码和连接插座。
问题似乎是从viewDidLoad方法生成的。。。目前看起来是这样的:
-(void)viewDidLoad{
[super viewDidLoad];
[view1 removeFromSuperview];
[view2 removeFromSuperview];
[view3 removeFromSuperview];
UIInterfaceOrientation curOrientation = self.Orientation;
if(curOrientation == UIInterfaceOrientationPortrait)
{
view1 = [[XView alloc] initWithFrame:CGRectMake(20,492,728,492)];
view2 = [[YView alloc] initWithFrame:CGRectMake(384,20,364,472)];
view3 = [[ZView alloc] initWithFrame:CGRectMake(20,20,364,472)];
[self.view addSubview:view1];
[self.view addSubview:view2];
[self.view addSubview:view3];
}
else if(curOrientation == UIInterfaceOrientationLandscapeRight)
{
//Different coordinates
}
else if(curOrientation == UIInterfaceOrientationLandscapeLeft)
{
//Different Coodinates
}
}
我不确定我在这里做错了什么。。。。我需要帮助。。。