几个小时以来,我一直试图弄清楚为什么UIScrollView
不会显示来自NSMutableArray
.
我意识到 uiimageview 对象位于 UISCrollview 内的子视图集合中,但不知何故 UIViewContentModeScaleAspectFit 被忽略了......那我如何适应缩放?
请问,有什么建议吗?
- (void)viewDidLoad
{
[super viewDidLoad];
BookDalc* bookDalc = [[BookDalc alloc] init];
NSMutableArray* books = [bookDalc FindByIconID:IconID];
for(int i = 0;i<books.count;i++)
{
CGRect frame;
frame.origin.x = self.scrBook.frame.size.width * i;
frame.origin.y = 0;
frame.size = self.scrBook.frame.size;
UIImageView *subview = [[UIImageView alloc] initWithFrame:frame];
subview.contentMode = UIViewContentModeScaleAspectFit;
BookEntity *currentModel = [books objectAtIndex:i];
UIImage *currentImage = [currentModel TheImage];
subview.image = currentImage;
[self.scrBook addSubview:subview];
}
self.scrBook.contentSize
= CGSizeMake(self.scrBook.frame.size.width * books.count, self.scrBook.frame.size.height);
}