我无法理解......它以前用于我使用旧版 IOS 框架制作的其他应用程序中
检查下面的代码:
如果我将 contentMode 更改为 Left 它会显示图像...
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
IBOutlet UIScrollView* scrBook;
}
@property (nonatomic, retain) IBOutlet UIScrollView* scrBook;
@end
@synthesize scrBook;
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect frame;
frame.origin.x = 0;
frame.origin.y = 0;
frame.size = self.scrBook.frame.size;
UIImageView *subview = [[UIImageView alloc] initWithFrame:frame];
//subview.contentMode = UIViewContentModeLeft;
subview.contentMode = UIViewContentModeScaleAspectFit;
UIImage *currentImage = [UIImage alloc];
currentImage = [UIImage imageNamed:@"model.jpg"];
subview.image = currentImage;
[self.scrBook addSubview:subview];
self.scrBook.contentSize
= CGSizeMake(self.scrBook.frame.size.width * 1, self.scrBook.frame.size.height);
}
UIViewContentModeLeft:
UIViewContentModeScaleAspectFit:
更新:我最后一次尝试是将 xcode 更新到 4.5.2,但它也不起作用,令人沮丧......