无法加载其名称存储在NSArray中的图像

时间:2012-05-24 16:16:42

标签: objective-c ios5

我正在尝试加载其名称存储在NSArray中的图像,以便在uiscrollview中添加这些图像,但我无法实现它,滚动视图不会加载图像。这是代码:

fotosJugadores = [[NSArray alloc] initWithObjects:@"cara5.png", @"cara7.png", @"cara8.png", @"cara9.png", @"cara11.png", @"cara13.png", @"cara14.png", @"cara15.png", @"cara18.png",@"cara19.png", @"cara20.png", @"cara32.png",@"cara44.png",@"cara51.png", nil];

for (int i = 0; i <    [fotosJugadores count]; i++) {

    UIImage *myImage = [UIImage imageNamed:[fotosJugadores objectAtIndex:i]];
    CGFloat yOrigin = i * myImage.size.width + 120;
    UIImageView *awesomeView = [[UIImageView alloc] initWithFrame:CGRectMake(yOrigin, 0, myImage.size.width, myImage.size.height)];
    awesomeView.tag = i;
    awesomeView.image = myImage;
    awesomeView.alpha = 0.5f;
    [self.jugadorSlide addSubview:awesomeView];
    awesomeView=nil;

}
非常感谢

0 个答案:

没有答案