【发布时间】:2014-01-23 16:05:49
【问题描述】:
我已经下载了一个 Gallery 示例代码,但我不知道如何使用它?它显示了 12 张相同的图片,我想要不同的图片,我想要一个 imagesArray 而不是一张图片,我该怎么办?
以下是我的代码,
#import "ViewController.h"
#import "UIViewAnimationExplose.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.allViews = [[NSMutableArray alloc]init];
int numberColumn = 0;
int numberRaw = 0;
for (int i = 0; i < 12; i++) {
UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(10 + numberColumn * 252, 10 + numberRaw * 248, 242, 238)];
img.contentMode = UIViewContentModeScaleAspectFill;
img.clipsToBounds = YES;
img.userInteractionEnabled = YES;
img.image = [UIImage imageNamed:@"becomeapanda_tumblr_com"];
[self.view addSubview:img];
[self.allViews addObject:img];
numberColumn++;
if (numberColumn > 2) {
numberRaw++;
numberColumn =0;
}
}
self.exploseContainer = [[AnimationExploseContainer alloc] initWithViews:self.allViews];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
【问题讨论】: