2014-02-22 2 views
1

저는 라이브러리 사용자의 사진 경로를 전달하는 뷰 (ImageView 만 포함)를 호출하고 있습니다. 그리고 나서, 에서 viewdidload 나는 이미지를로드 중입니다. 하지만 이미지의 오른쪽 상단 모서리에 "슈퍼 줌"이 표시됩니다. 왜 그런지 모르겠습니다!iOS : photolibrary에서 이미지 열기

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    self.navigationController.navigationBar.translucent = NO; 

    UIImage *picture = [UIImage imageWithContentsOfFile: self.picturePath]; 
    UIImageView* imageView = [[UIImageView alloc] initWithImage:picture]; 
    imageView.contentMode = UIViewContentModeScaleAspectFit; 

    [self.view addSubview:imageView]; 

} 
+0

사진의 크기는 무엇입니까? imageView : NSLog (@ "% @", NSStringFromCGRect (imageView.frame)); – Corey

+0

반환 된 {{0, 0}, {3264, 2448}} –

+0

이미 시도한 : self.imageView. 프레임 = CGRectMake (0, 0, self.view.bounds.size.width, self.view.bounds.size.height); addSubview before ... 같은 결과를 얻으십시오 –

답변

1

귀하의 의견에 따르면,로드하는 이미지가 매우 큽니다. 만들려는 UIImageView은 이미지의 너비/높이를 사용합니다. 이미지 뷰의 프레임을 설정하거나 펜촉의 IBOutlet을 사용하여 기존 UIImageView에 사진을 추가 할 수 있습니다. 코드에서

당신은 새로운 UIImageView를 만드는, 그래서 같이 업데이트 된 코드는 같을 것이다

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    self.navigationController.navigationBar.translucent = NO; 

    UIImage *picture = [UIImage imageWithContentsOfFile: self.picturePath]; 
    UIImageView* imageView = [[UIImageView alloc] initWithImage:picture]; 
    // Set your frame size 
    imageView.frame = CGRectMake(0.0, 0.0, 320.0, 320.0); 
    imageView.contentMode = UIViewContentModeScaleAspectFit; 

    [self.view addSubview:imageView]; 

} 
+0

물론! 이 작품 :) 감사 코리! 자, 그림이 작아서 ... 어쨌든 모든 화면을 사용하도록이 이미지를 설정하고 있습니까? iPhone의 네이티브 사진 라이브러리처럼 ... –

+1

imageView.frame = CGRectMake (0, 0, screenRect.size.width, screenRect.size.height); imageView.contentMode = UIViewContentModeScaleAspectFill; 가득한 크기의 그림을 위해! –

관련 문제