我在我的 iOS 项目中使用了以下插件,https: //www.cocoacontrols.com/controls/mkmovingblockanimation,但是我想从 URL 数组而不是本地资源加载图像。我在我认为需要修改的片段下方附上了..
有任何想法吗?
self = [super initWithFrame:frame];
if (self) {
self.slideImages = [[[NSMutableArray alloc] init] autorelease];
for (int i = 1; i < 10; i++) {
[self.slideImages addObject:[self imageWithBorderFromImage:[[CacheManager sharedInstance] imageNamed:[NSString stringWithFormat:@"image%d.png", i]]]];
}
for (int i = 0; i < rows; i++) {
UIImage* img = [self.slideImages objectAtIndex:arc4random() % [self.slideImages count]];
int size = frame.size.width;
UIImageView *imageView = [[UIImageView alloc] initWithImage:img];
imageView.frame = CGRectMake(0, 0, size - 6, size - 6);
imageView.center = CGPointMake(self.frame.size.width/2, i * self.frame.size.height/8);
[self addSubview:imageView];
[imageView release];
}
}
return self;