当我在滚动视图中查看图像时,我改变了手机的方向,scrollview不会改变手机的方向。当方向改变时UIScrollview大小
林想知道如果有人可以向我解释如何做到这一点。
这些都是在我的界面生成器设置
我刚才已经做了一些研究,现在有第一选择工作,但如果我尝试另一张照片它dosnt工作..和我不能确定为什么..我的继承人代码
这是什么使这半工作
scrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
- (void)loadImage:(NSString *)myImageName
{
// //Create scrollview
scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
scrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
scrollView.delegate = self;
//Create scrollviewimage
if ([myImageName isEqualToString:@"one"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hyundai.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 350, 550)];
NSLog(@"1");
}
if ([myImageName isEqualToString:@"two"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"keso.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600, 520)];
NSLog(@"2");
}
if ([myImageName isEqualToString:@"three"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"conforti.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600, 700)];
NSLog(@"3");
}
//Add subview
[containerView addSubview:image];
//initViews
// scrollView.contentSize = containerView.frame.size;
[scrollView addSubview:containerView];
//scrolling
scrollView.minimumZoomScale = 1.0;
scrollView.maximumZoomScale = 31.0;
scrollView.BackgroundColor = UIColor.whiteColor;
[scrollView setZoomScale:scrollView.minimumZoomScale];
//highrachy
[self.view addSubview:scrollView];
scrollView = nil;
}
编辑:应对@D Ĵ
这是输出
2012-02-01 13:30:35.683 Diagram Test[1672:707] The view controller <UINavigationController: 0x14cdd0> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.
2012-02-01 13:30:44.182 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:47.097 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:47.158 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:51.509 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:51.555 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:55.473 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:55.519 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:59.293 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:59.352 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:31:02.237 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:31:02.281 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:31:03.814 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:31:03.858 Diagram Test[1672:707] height = (null)i, width = (null)i
将图像添加到UIScrollView的代码是什么?其他物体是否改变方向?实际上,在你发布它之后,就像你有一个UIScrollView占据整个Iphone屏幕一样,它可能是你的视图控制器。 – DJPlayer 2012-02-01 00:22:39