我正在尝试在填充真实数据之前创建示例库。
    float xAxis = 0;
    float mostHeight = self.galleryView.bounds.size.height;
    for (int i = 0; i < 5; i++) {
        //getImage from url
        UIImage* myImage = [UIImage imageWithData: 
                            [NSData dataWithContentsOfURL: 
                             [NSURL URLWithString: @"http://4.bp.blogspot.com/-M9k3fhlUwmE/TdYgxL97xMI/AAAAAAAAAY8/_r45zbAm1p0/s1600/CARTOON_Cat-full.jpg"]]];
        myImage = [[MyMath sharedMySingleton] imageWithImage:myImage convertToSize:CGSizeMake(mostHeight - 10, mostHeight - 10)];
        //set image
        UIImageView *rview= [[UIImageView alloc] initWithImage:myImage];
        /*adding the view to your scrollview*/
        [self.galleryView addSubview:rview];
        xAxis += myImage.size.width + 20;
    }
    //set scrolling area
    self.galleryView.contentSize = CGSizeMake(xAxis, mostHeight);
galleryView 是来自 xib 的 UIScrollView。在这里,我试图将 5 张相同的图片填充到图库,但它只填充了一张和之后的空格(因为 xAxis 编号)。我做错了什么?
PS我是iPhone sdk的新手,所以不要评判我