UIScrollView を作成し、配列から画像を表示していますが、画像が表示されません
ここに私のコードがあります
- (void)viewDidLoad
{
[super viewDidLoad];
imageScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(13.0, 50.0, 292.0, 69.0)];
[self makeScroll];
}
-(void)makeScroll
{
imageScroll.delegate = self;
imageScroll.backgroundColor = [UIColor clearColor];
int arrayCount = [myArray count];
imageScroll.contentSize = CGSizeMake(arrayCount * 101.0, 69.0);
for (int i = 0; i < arrayCount; i++)
{
participantView = [[UIView alloc]init];
if (i == 0) {
participantView.frame = CGRectMake(0.0, 2.0, 91.0, 67.0);
}
else {
participantView.frame = CGRectMake(101.0*i, 2.0, 91.0, 67.0);
}
participantView.backgroundColor = [UIColor yellowColor];
//declaring the view in which image object will be added
UIImageView *bannerImage = [[UIImageView alloc]
initWithFrame:CGRectMake(0.0,0.0,91.0,67.0)];
//taking out the image object
UIImage *imageNamed = [UIImage imageNamed:[myArray objectAtIndex:0]];
//resizing the image
// UIImage *imageNamed2 = [imageNamed
imageByScalingAndCroppingForSize:CGSizeMake(91.0,67.0)];
//setting the resized image in UIImageView
[bannerImage setImage:imageNamed];
//clear the bg
bannerImage.backgroundColor = [UIColor clearColor];
bannerImage.autoresizingMask = UIViewAutoresizingFlexibleHeight;
bannerImage.contentMode = UIViewContentModeScaleAspectFit;
[bannerImage setNeedsLayout];
bannerImage.frame = CGRectMake(0.0,0.0,91.0,67.0);
[participantView addSubview:bannerImage];
[imageScroll addSubview:participantView];
}
[self.view addSubview:imageScroll];
}
誰か私がどこで間違っているのか教えてください
問題は: 画像がスクロールビューに表示されない