0

基于一些较早的问题(例如:ios5 如何通过 prepareForSegue: a UIImageView)我想知道这种技术有多流畅,比如在使用动画 = NO 进行模态转场时。

我可以拼凑一个测试,但我想有人已经确定了将其用作过渡技术的性能和实际缺陷。我很想听听任何细节——例如,UIImageView 动画是重新启动还是继续快速进行?

4

1 回答 1

0

If you pass an animating image view to another controller, it looks like the animation continues apace. I can't see any "hitch" in the animation. Going forward with a modal presentation worked fine. I couldn't go back to the first controller, by just dismissing, I had to add the image view back to the view to make that work, and even then it only worked if I turned off auto layout (otherwise I get an error saying it can't install a constraint). So, to go back and forth with modals (with no animation) I had this in the first controller:

- (void)viewDidLoad {
    [super viewDidLoad];
    self.isFirst = YES;
    NSMutableArray *imgArray = [NSMutableArray array];
    for (int i = 1; i< 41; i++) {
        UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"New_PICT%04d.jpg",i]];
        if (img) {
            [imgArray addObject:img];
        }
    }
    self.iv.animationImages = imgArray;
    self.iv.animationDuration = 10;
    [self.iv startAnimating];
}

-(void)viewDidAppear:(BOOL)animated {
    if (self.isFirst) {
        self.isFirst = NO;
    }else{
        self.iv.frame = CGRectMake(48, 48, 48, 48);
        [self.view addSubview:self.iv];
    }
}


-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    SecondViewController *sec = segue.destinationViewController;
    sec.iv = self.iv;
}
于 2013-03-16T17:49:31.470 回答