开发者

UIScrollView not scrolling in xcode 4?

开发者 https://www.devze.com 2023-04-13 05:44 出处:网络
For some reason UIScrollView is not working. It did work before I add the content but after it stop working. I\'m stuck can someone help me out!

For some reason UIScrollView is not working. It did work before I add the content but after it stop working. I'm stuck can someone help me out!

Here is my code

This is the code for my UIScrollView

@interface EditAccountViewController : UIViewController {
   IBOutlet UIScrollView *svScroller;
}

Here is my view Load code

- (void)viewDidLoad
{
   [super viewDidLoad];
   [svScroller setScrollEnabled:YES];
   [svScroller setContentSize:CGSizeMake(320, 930)];
}

Here is my objects view


It works also with that.

To my understanding "autolayout" set constraint after loading the view so the problem could be that you set your constrains on viewDidLoad and just after that "autolayout" changes that. Try to set this constrains on viewDidAppear.

Get it from: scrollview xcode4.5 autolayout. Thanks.


Always keep in mind that the content view needs to be larger than the UIScrollView instance frame size. If it isn't, it will not enable scrolling.

This applies to UITableView as well. The scrolling for UITableView will not appear unless there are more rows to be displayed than actually are.


I resolved the issue. I just bump the height in [svScroller setContentSize:CGSizeMake(320, 1500)]; and It's working fine.

0

精彩评论

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

关注公众号