0

我正在制作一个我只会在模式下制作iPhone的应用程序。应用程序中有一点,如果用户触摸图片,它会自动生成. 我这样做的方式是通过 segue 到另一个视图控制器,其中 a占据了整个空间。我希望能够旋转设备以查看图片。iPodportraitfullscreenUIImageViewlandscapelandscape

这怎么可能?

在第二阶段:我想知道如何制作视图fullscreen,以便图片可以填满整个屏幕。

基本上:我希望图片的行为就像 twitter 应用程序一样。:)

谢谢

编辑:这是我的类中查看图像的代码

#import "ImageViewer.h"

@interface ImageViewer ()

@end

@implementation ImageViewer
@synthesize scrollView;
@synthesize imageView;
@synthesize image;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.


    CGRect imageFrame = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height);

    self.imageView.frame = imageFrame;
    self.scrollView.contentSize = imageFrame.size;

}

- (UIView *) viewForZoomingInScrollView:(UIScrollView *)sender
{
    return self.imageView;
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-  (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    NSLog(@"rotate.");
    return YES;
}

- (void)viewDidUnload {
    [self setImageView:nil];
    [self setScrollView:nil];
    [super viewDidUnload];
}
@end
4

0 回答 0