我在本地数据库中存储了一些图像。我使用 sqlite 从数据库中获取图像并使用数组显示。然后我将该图像数组添加到滚动视图中。但是滚动视图不起作用。
代码:
.h 文件:
NSMutableArray *arraysofs;
-(void)unloadPreviousPage:(int)index;
-(void)loadNextPage:(int)index;
.m 文件:
-(void)click:(id)sender{
scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
scroll.pagingEnabled = YES;
for (int i = 0; i<[self.arraysofs count]; i++ ) {
NSLog(@"index %d",i);
mmageView=[[UIImageView alloc]initWithFrame:CGRectMake(20+(i*74), 420, 72, 72)];
[mmageView setImage:((Mysof *) [self.arraysofs objectAtIndex:i]).photo];
[scroll addSubview:mmageView];
}
[scroll setContentSize:CGSizeMake(CGRectGetMaxX(mmageView.frame),self.view.frame.size.height)];
[self.view addSubview:scroll];
}