【发布时间】:2013-01-29 10:27:04
【问题描述】:
当我从纵向模式切换到横向模式时,视图应该扩大,但长度应该相同并且在滚动视图中,这样当我滚动时应该显示全部内容:
if (([[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeLeft) ||
([[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeRight))
{
UIScrollView *scrollView=[[UIScrollView alloc] init];
UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 480, 480)];
view1 = self.view;
[scrollView addSubview:view1];
scrollView.frame = CGRectMake(0, 0, 480, 480);
scrollView.contentSize = CGSizeMake(480, 480);
scrollView.delegate = self;
scrollView.alwaysBounceVertical = YES;
[self.view addSubview:scrollView];
}
【问题讨论】:
-
任何人都可以发送代码
-
谷歌一下,问之前先试一下
-
我试过了,但无法展开视图并显示它...
-
显示您尝试过的代码。
-
if(([[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeLeft) || ([[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeRight)) { UIScrollView * scrollView=[[UIScrollView alloc] init]; UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 480, 480)]; view1 = self.view; [scrollView addSubview:view1]; scrollView.frame = CGRectMake(0, 0, 480, 480); scrollView.contentSize = CGSizeMake(480, 480); scrollView.delegate = 自我; scrollView.alwaysBounceVertical = YES; [self.view addSubview:scrollView]; }
标签: objective-c ios6 uiscrollview xcode4.5