【发布时间】:2011-03-21 01:18:06
【问题描述】:
我正在努力解决这个问题。 我的应用需要纵向视图和横向视图。现在,当我创建 2 个显示纵向视图和横向视图(由 shouldAutorotateToInterfaceOrientation 强制)的按钮时,它们显示得很好。但是当我从图像选择器的结果代码中调用视图时,纵向视图工作得很好,但是横向视图会像这样返回。 http://bit.ly/bfbobc.
所以要说清楚:nob 已经转了 90 度,imageviewcontrol 只显示了一半(右侧部分在屏幕外)...但是 iPhone 没有被强制进入横向模式...
有人可以解释一下这里发生了什么或我如何实现这一点!欢迎任何帮助!
这就是我使用 imagepickercontroller 结果代码调用视图的方式。
`- (void) imagePickerController:(UIImagePickerController *)vcImagePicker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSLog(@"图片已被拍摄/选择,现在我们需要决定展示哪个视图");
[vcImagePicker dismissModalViewControllerAnimated:YES];
UIImage *chosenPicture = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
if (chosenPicture.size.width > chosenPicture.size.height) {
NSLog(@"pic is in landscape");
EditLandscapeScreen *vcEditLandscapeScreen = [[EditLandscapeScreen alloc] initWithNibName:@"EditLandscapeScreen" bundle:nil];
vcEditLandscapeScreen.ChosenImage = chosenPicture;
[self.view addSubview:vcEditLandscapeScreen.view];
[vcEditLandscapeScreen release];
}
else {
NSLog(@"pic is in portrait");
EditPortraitScreen *vcEditPortraitScreen = [[EditPortraitScreen alloc] initWithNibName:@"EditPortraitScreen" bundle:nil];
vcEditPortraitScreen.ChosenImage = chosenPicture;
[self.view addSubview:vcEditPortraitScreen.view];
[vcEditPortraitScreen release];
}
}`
【问题讨论】:
标签: iphone xcode view uiimageview rotation