放置对象后,ScrollView不会滚动

时间:2013-05-14 19:39:33

标签: scrollview

我想这会接受但我开始变得非常沮丧: 我是第一次写代码所以请帮忙。 使用X-Code,objective-C。

我希望能够在我的App-Pages上滚动,所以我添加了一个UIScrollView:

@interface HeggViewController : UIViewController
{
IBOutlet UIScrollView *scroller;

}

@implementation HeggViewController

- (void)viewDidLoad
{
[scroller setScrollEnabled:YES];
[scroller setContentSize:CGSizeMake(320, 1000)];
[super viewDidLoad];

它可以正常工作,直到我添加一些东西。按钮,图片,标签...... 我可以只向ScrollView添加按钮,还是首先需要放置其他内容

我做错了什么?

感谢您的帮助..

1 个答案:

答案 0 :(得分:0)

您没有显示添加对象的代码,但如果您执行以下操作,则必须正常工作:

// Create your image
UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(79, 20, 100, 100)];
// Add the image to the scrollview
[scroller addSubview:image];
相关问题