代码之家  ›  专栏  ›  技术社区  ›  Jonah

如何将图像加载到iphone系统缓存中?

  •  0
  • Jonah  · 技术社区  · 14 年前

    我尝试将以下代码添加到viewDidLoad方法中:

    for (int i = 0; i < appDelegate.detailSectionsDelegateDict.count; i++) {
             NSString *imageString = [NSString stringWithFormat:@"%@",[[appDelegate.detailSectionsDelegateDict objectAtIndex:i] objectForKey:@"MainTrackImage"]];
            NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
            UIImage* theImage;
            theImage = [UIImage imageNamed:imageString];
             [imageCacheArray insertObject:theImage atIndex:i];
    }
    

    然后在cellforrowatinexpath方法中从imageCacheArray中绘制正确的图像。但结果仍然是不稳定的滚动。

    谢谢!

    1 回复  |  直到 14 年前
        1
  •  3
  •   Matt Long    14 年前

    session videos from this year's WWDC ,具体看第425课时,“实践中的核心动画,第2部分”,他们涵盖了这个确切的主题,做得非常好。如果您使用开发人员帐户登录,也可以获得相关的源代码。