Iphone scrollview无法从数据库映像工作

Iphone scrollview无法从数据库映像工作,iphone,ios,uiscrollview,uiimageview,nsmutablearray,Iphone,Ios,Uiscrollview,Uiimageview,Nsmutablearray,我在本地数据库中存储了一些图像。我使用sqlite从数据库中获取图像,并使用数组显示。然后我将该图像数组添加到scrollview中。但是scrollview不起作用 代码: .h文件: NSMutableArray *arraysofs; -(void)unloadPreviousPage:(int)index; -(void)loadNextPage:(int)index; .m文件: -(void)click:(id)sender{ scroll = [[UIScr

我在本地数据库中存储了一些图像。我使用sqlite从数据库中获取图像,并使用数组显示。然后我将该图像数组添加到scrollview中。但是scrollview不起作用

代码:

.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];


    }
-(无效)单击:(id)发件人{
scroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height)];
scroll.paginEnabled=是;

对于(inti=0;i,在单击方法中设置scrollview的内容大小,如下所示

-(void)click:(id)sender{

for (int index = 0; index < [self.arraysofs count]; index ++ ) {
         NSLog(@"index %d",index);

        mmageView=[[UIImageView alloc]initWithFrame:CGRectMake(20+(index*74), 52, 72, 72)];

        [self.view addSubview:mmageView];

        Soflistsql * mysofs =[[Soflistsql alloc] init];
        self.arraysofs = [mysofs getMyLists];
        [mmageView setImage:((Mysof *) [self.arraysofs objectAtIndex:index]).photo];
    }

[your_ScrollView setContentSize:CGSizeMake(CGRectGetMaxX(mmageView.frame),self.view.frame.size.height)];
}
-(无效)单击:(id)发件人{
for(int index=0;index<[self.arraysofs count];index++){
NSLog(@“索引%d”,索引);
mmageView=[[UIImageView alloc]initWithFrame:CGRectMake(20+(索引*74,52,72,72)];
[self.view addSubview:mmageView];
Soflistsql*mysofs=[[Soflistsql alloc]init];
self.arraysofs=[mysofs getMyLists];
[mmageView setImage:((Mysof*)[self.arraysofs objectAtIndex:index]).photo];
}
[u ScrollView setContentSize:CGSizeMake(CGRectGetMaxX(mmageView.frame)、self.view.frame.size.height)];
}

我尝试了这个方法。它不起作用。我需要制作水平滚动视图,这就是我在
中所做的[your_ScrollView setContentSize:CGSizeMake(CGRectGetMaxX(mmageView.frame),self.view.frame.size.height)]59444x74=288..所以我认为这可能是个问题。。。