the scrollview is not scrolling at xib file

前端 未结 1 1284
没有蜡笔的小新
没有蜡笔的小新 2021-01-20 08:20

I am new in iphone development.. I have added the scrollview in my app and added 10 buttons graphically inside the scrollview. but when I run the scrollview is not scrolling

1条回答
  •  礼貌的吻别
    2021-01-20 08:33

    It looks like you are taking scrollview in xib. So, you need to remove [self.view addSubview:scrollview]; from your code and you can directly set properties of that scrollview in xib except setContentSize(that you need to set in .m file).

    Or if you want to create scrollView manually, remove from xib and use this:

    UIScrollView * content = [[UIScrollView alloc] initWithFrame:self.view.bounds];
    [content setContentSize:CGSizeMake(width, height)];
    //Here you can add those buttons to content view
    [self.view addSubView:content];
    

    0 讨论(0)
提交回复
热议问题