我想使用icarousel显示图像,但我不知道图像大小,因此它不会显示它被挤压或类似的东西。我想裁剪它以使它完美贴合。有谁知道图像大小?
答案 0 :(得分:1)
你可以在这里设置视图大小,
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
{
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",[menuViews objectAtIndex:index]]];
UIView* _reflectionView =[[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, image.size.width, image.size.height)] autorelease];
UIImageView *imgview = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)] autorelease];
imgview.image = image;
[_reflectionView addSubview:imgview];
return _reflectionView;
}