[英]Using UIImageView to make a app like iPhone's Photo Galerry
請幫我 ! 我制作了一個帶有幻燈片的應用,如帶有后退,上一步按鈕的幻燈片,以逐一更改圖片。 但是,當我使用大圖像時,它會崩潰。 現在,我正在使用64張jpg圖片,大小約為20kb / 1pic。
救救我或我死! (您可以添加nick hoangtuanfithou)這樣的代碼:
//初始化圖像數組
-(void)InitImageArray1
{
myAnimationImages1 = [[NSMutableArray alloc] init];
for ( int i = 0; i < 24; i++ )
{
NSAutoreleasePool *poolArray=[[NSAutoreleasePool alloc] init];
NSString *fileName = [NSString stringWithFormat:@"001 (%d)",i];
image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fileName ofType:@”jpg”]];
[myAnimationImages1 addObject:image];
[poolArray release];
}
}
//更改圖片self.mainImage.image = [self.myAnimationImages1 objectAtIndex:animationImageArrIndex];
請參閱蘋果的頁面控制示例,或查看github上的滾動瘋狂。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.