Can't scroll in UIScrollView as soon as UILabel / other subview added in Storyboard

痴心易碎 提交于 2019-12-07 03:30:37

问题


I encountered the following problem: as soon as I add e.g. a UILabel to my UIScrollView - using the storyboard - the scroll view stops "working" (with that I mean you cannot scroll at all). However adding a subview programmatically the scroll view works fine but since I prefer designing my apps visually with storyboard I would like to solve this mysterious error.

Does anyone knows why this error is occurring? Thanks in advance :)

PS: I do set the contentSize of my scrollView, so this cannot be the problem!


回答1:


Move the code in the viewDidAppear function like this

-(void)viewDidAppear:(BOOL)animated{

[super viewDidAppear:animated];
self.scrollView.contentSize = CGSizeMake(500.f, 500.f);

}



来源:https://stackoverflow.com/questions/12459049/cant-scroll-in-uiscrollview-as-soon-as-uilabel-other-subview-added-in-storybo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!