开发者

How to reduce the size of uiscrollview from top

开发者 https://www.devze.com 2023-01-18 06:24 出处:网络
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

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

精彩评论

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