1

我有一个 UIImageView ,我想在其中显示存储在 sqlite 中的动画系列图像。我怎样才能做到这一点?

在 .hi 有喜欢..

         UIImageView *photosImgView;

       @property(nonatomic,retain)IBOutlet UIImageView *photosImgView;

在.mi 有喜欢..

  @synthesize photosImgView;

    - (void)viewDidLoad
        {
            [super viewDidLoad];

            PeopleTable *ppl = [[People alloc] init];

         photosImgView.animationImages=[NSArray arrayWithArray:ppl.photo]; //(problem is   in this line)

       photosImgView.animationDuration = 5;
      photosImgView.animationRepeatCount = 1;
      [photosImgView startAnimating];

     [self.view addSubview:photosImgView];
 }

请帮助我..提前谢谢...

4

1 回答 1

0

使用FMDB,这很容易...

并在你的桌子上做一个循环(选择)

NSMutableArray *imgs = [NSMutableArray array];
FMResultSet *s = [db executeQuery:@"SELECT * FROM myTable"];
while ([s next]) {
    [imgs addObject:[s stringForColumn:@"row"]];
}

photosImgView.animationImages=imgs;

完毕!

于 2012-11-29T11:10:38.583 回答