我有一个UIPageViewController,其中视图中添加了两个子视图:带有UITapGestureRecognizer的透明子视图和带有一些按钮的工具栏,当我点击另一个子视图时,该按钮从底部向上滑动。UIPageViewController在旋转之后将子视图带到前面
编辑。 这是子视图设置在viewDidAppear:(BOOL)动画
CGRect frame;
if (UIDeviceOrientationIsPortrait([[UIDevice currentDevice]orientation])){
frame = CGRectMake(50, 0, 220, 480);
}
else {
frame = CGRectMake(50, 0, 380, 320);
}
if (!tapView) {
tapView = [[LSTapView alloc]initWithFrame:frame];
//[tapView setBackgroundColor:[UIColor colorWithRed:1 green:0 blue:0 alpha:0.4]];
[self.view addSubview:tapView];
[tapView release];
}
else {
if (UIDeviceOrientationIsPortrait([[UIDevice currentDevice]orientation])){
[tapView setFrame:CGRectMake(50, 0, 220, 480)];
[fontViewController.view setFrame:CGRectMake(0, 480, 320, 92)];
}
else {
[tapView setFrame:CGRectMake(50, 0, 380, 320)];
[fontViewController.view setFrame:CGRectMake(0, 320, 480, 92)];
}
}
if (!fontViewController){
fontViewController = [[LSFontViewController alloc]initWithNibName:@"LSFontView" bundle:nil];
}
if (UIDeviceOrientationIsPortrait([[UIDevice currentDevice]orientation])){
[fontViewController.view setFrame:CGRectMake(0, 480, 320, 92)];
}
else {
[fontViewController.view setFrame:CGRectMake(0, 320, 480, 92)];
}
[self.view addSubview:fontViewController.view];
如果我改变页面,而无需旋转设备,一切都运行在两个方向的罚款。然而,当我旋转设备时,这两个子视图消失了,我发现它们不在前面。无论如何,如果我加入这个我的代码:
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
[self.view bringSubviewToFront:tapView];
[self.view bringSubviewToFront:fontViewController.view];
}
一个奇怪的现象发生了:我不能改变的网页了,或者更好的,一个和下一个viewControllers正确加载,但他们不显示和网页别改变。
有人可以解释我发生了什么?
谢谢。 L.
你能告诉你如何最初设置你的子视图? – sergio 2012-08-03 17:16:09
当然,我会编辑问题.. – Lolloz89 2012-08-04 09:18:27