原本程式基本上是沒啥問題

但是遇到影像快速移動有時會出現影像互相交疊...

像是影像上半部是A下半部卻是B,改了很多寫法都沒法解決

後來看到 iOS7 有新的 function 可用,馬上試了一下,發現問題沒再發生了!

但是 iOS6 就...炸了XD

修改後 code

UIGraphicsBeginImageContext(CGSizeMake(200, 200));
UIImageView imageView;
[imageView.image drawViewHierarchyInRect:imageView.bounds afterScreenUpdates:NO];
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

原本 code

UIGraphicsBeginImageContext(CGSizeMake(200, 200));
UIImageView imageView;
[imageView.image drawInRect:imageView.bounds];
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

 

Snapshotting Views in iOS 7

iOS: what's the fastest, most performant way to make a screenshot programatically

 

arrow
arrow
    全站熱搜

    JohnDX 發表在 痞客邦 留言(0) 人氣()