开发者

iOS: Can you set up a ScrollView under IB?

Can't seem to find a good tutorial for ScrollView so I've been trying to set it up myself using IB - is this even possible?

I've added a scrollview to a ViewController, sized it to 640x200, added a view at the same size with 2 labels at each end开发者_高级运维. Created an outlet and linked it up to Files Owner, but when I run I see the first label but it won't scroll. Basically I'm trying to create a half-height horizontal scroller to show a number of buttons, but I can't even get it moving.

Little help?

Thanks


I´ve never managed to get desired results for the scroll view using IB. These two lines always do the trick:

   [mainScrollView setFrame:CGRectMake(0, 0, 320, 700)];
  [mainScrollView setContentSize:CGSizeMake(320,1200)];


As far as I know there is no way to set the contentSize in IB. So set it in viewDidLoad method of your view controller.

[myScrollView setContentSize:CGSizeMake(640,200)];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜