【发布时间】:2014-03-07 20:55:17
【问题描述】:
谁能帮我处理这段代码?只是它不起作用,就像我尝试过的所有垂直滚动一样。我开始认为我的 Xcode 模拟器有问题。代码如下:
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(10, 30, 300, 400)];
[self.view addSubview:scroll];
[scroll setBackgroundColor:[UIColor redColor]];
{
UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1222, 400)];
[imageview setImage:[UIImage imageNamed:@"panorama_orizzonte_medio_big.jpg"]];
[scroll addSubview:imageview];
[self.view addSubview:scroll];
}
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
【问题讨论】:
-
你想做什么?你想滚动图片吗?
-
是的,我按照教程来水平滚动图像。我一步一步跟着它,但我的模拟器没有滚动。
标签: uiscrollview uiimageview horizontal-scrolling