在dismissViewControllerAnimated之后,Scrollview没有滚动

时间:2013-05-21 17:43:13

标签: iphone ios objective-c

我正在使用以下代码从我的mainScreen调用视图控制器:

VisualizarFotoViewController *visualizarFoto = [self.storyboard instantiateViewControllerWithIdentifier:@"VisualizarFoto"];
[self presentViewController:visualizarFoto animated:NO completion:^{
    [UIImageView animateWithDuration:0.5 animations:^{
        visualizarFoto.visualizarFoto.contentMode = UIViewContentModeScaleAspectFit;
        visualizarFoto.visualizarFoto.image = _fotoPrincipal.image;
        visualizarFoto.viewPrincipal.alpha = 1;
        visualizarFoto.telaOrigem = 2;

    }];
}];

要返回主屏幕,我使用以下代码关闭视图控制器:

[UIImageView animateWithDuration:0.2 animations:^{
    _viewPrincipal.alpha = 0;
} completion:^(BOOL finished) {
    [self dismissViewControllerAnimated:NO completion:nil];
}];

我的问题是,当我回到主屏幕时,我的滚动视图无法回答任何滚动手势。我尝试在[_scrollView becomeFirstResponder]部分使用viewDidAppear,但没有成功。 你有什么提示要解决这个问题吗? 感谢

1 个答案:

答案 0 :(得分:4)

如果有人在寻找答案,我就是为解决这个问题而做的:

- (void)viewDidLayoutSubviews {
    // Define the scrollview size accordingly with the number of pages
    [_scrollView setFrame:CGRectMake(0, 43, 320, 450)];
    [_scrollView setContentSize:CGSizeMake(320 * 3, 450)];
}