2014-02-07 55 views
1

我真的有最基本的代碼,我很疲憊,爲什麼它不會放大:爲什麼我無法縮放嵌入在UIScrollView中的UIImageView?

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth([UIScreen mainScreen].bounds), CGRectGetHeight([UIScreen mainScreen].bounds))]; 
    self.scrollView.delegate = self; 
    self.scrollView.contentSize = self.imageView.bounds.size; 
    self.scrollView.minimumZoomScale = 0.5; 
    self.scrollView.maximumZoomScale = 10.0; 

    [self.view addSubview:self.scrollView]; 

    self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"community1.jpeg"]]; 
    self.imageView.contentMode = UIViewContentModeScaleAspectFit; 

    [self.scrollView addSubview:self.imageView]; 
} 

在模擬器我嘗試放大和什麼都沒有發生。如果這是相關的,這是一個相當大的圖像。

回答

1

您是否在滾動視圖的代表中實施了-viewForZoomingInScrollView:?如果沒有,你需要這樣做,當你捏的時候返回你想要實際縮放的視圖。

相關問題