Ensemble UIImageView Taille?

j'ai le problème suivant: je créer des sous-vues UIView dans un UIScrollView y compris UIImageViews.

NSArray *bilder = [[NSArray alloc] initWithObjects:@"lol.jpg", @"lol2.jpg", nil];
NSArray *added = [[NSMutableArray alloc] init];
UIImageView *tmpView;

for (NSString *name in bilder) {
    UIImage *image = [UIImage imageNamed:name];
    tmpView = [[UIImageView alloc] initWithImage:image];
    tmpView.contentMode = UIViewContentModeScaleAspectFit;
    tmpView.frame = CGRectMake(0, 0, 300, 300);

    [added addObject:tmpView];

    [tmpView release];
}

CGSize framy = mainFrame.frame.size;

NSUInteger x = 0;

for (UIView *view in added) {
    [mainFrame addSubview:view];
    view.frame = CGRectMake(framy.height * x++, 0, framy.height, framy.width);
}

mainFrame.scrollEnabled = YES;
mainFrame.pagingEnabled = YES;
mainFrame.contentSize = CGSizeMake(framy.height * [added count], framy.width);
mainFrame.backgroundColor = [UIColor blackColor];

- je obtenir des noms de fichier d'image d'un tableau. maintenant, je veux redimensionner l'imageview à une taille spécifique, mais il ne fonctionne pas. des conseils?

merci + ce qui concerne

OriginalL'auteur Tronic | 2010-04-22