开发者

How to reduce the size of uiscrollview from top

I am creating a music application i开发者_Python百科n which I am adding a scrollview to uiview, and another view is without scrollview. I want to reduce the size of scrollview from top. When I reduce the size of scrollview it gets reduced from bottom and that is a problem.

This is my code for scrollview:

scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,320,360)];
[[self view] addSubview:scroll];
[scroll setScrollEnabled:YES];
[scroll setBounces:NO];
[scroll setAlwaysBounceHorizontal:NO];

First the size of scrollview was 320,400 I reduced it by 40 and made it to 360 and so it get reduced from bottom. I want it should get reduced from top. How it is possible?


Well, if you reduce the size of the view but you want the bottom to remain at the same coordinate you just need to adapt the y coordinate accordingly as in:

scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0,40,320,360)];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜