我創建一個PFImageView與默認圖像。然後我在後臺加載一個圖像,當圖像從服務器上完成下載時,它立即顯示出來,佔位符/默認圖像被替換。問題是,從默認轉換到下載的圖像不是很愉快。有沒有一種方法可以創建淡入淡出狀態並淡入到下載的動畫中?是否可以在PFImageView中爲新加載的圖像設置動畫效果?相關parse.com PFImageView
這是我的代碼。
// set the pfImageView into the webView
_pfImageView = [[PFImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%dpTall.jpg", [self.drink.glassId intValue]]]];
_pfImageView.frame = CGRectMake(244, 0, 76, 114);
[webView.scrollView addSubview:_pfImageView];
// create a query for finding images on Parse
PFQuery *query = [PFQuery queryWithClassName:@"Images"];
[query whereKey:@"drinkId" equalTo:[NSNumber numberWithInt:self.drink.primaryKey]];
[query getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) {
if (!error) {
PFFile *imageFile = [object objectForKey:@"image"];
_pfImageView.file = imageFile;
[_pfImageView loadInBackground];
} else {
NSLog(@"PFQuery Error:%@", [error localizedDescription]);
}
}];
感謝
你在尋找什麼樣的過渡? –
UIViewAnimationOptionTransitionCrossDissolve – jmurphy