简体   繁体   English

设备旋转后垂直滚动条的尺寸错误

[英]Vertical scroll bar has wrong size after device rotation

I have a function where I make a UIScrollView and one more function for resizing UIView if InterfaceOrientation did change, but after rotating my vertical scroll bar has 1/3 the size of the width of my ScrollView. 我有一个函数,可以制作一个UIScrollView,如果InterfaceOrientation确实发生了变化,还可以再提供一个用于调整UIView大小的函数,但是旋转垂直滚动条后,其大小是ScrollView宽度的1/3。

wrapper.frame = CGRectMake(0,
                           cover_h + thumb_border*2,
                           startView.frame.size.width,
                           startView.frame.size.height-(cover_h+thumb_border*3));

wrapper.contentSize = CGSizeMake((int)thumb_w*2+thumb_border-1,(int) thumb_h*(slice/2)+thumb_border*((slice-1)/2));
wrapper.contentInset = UIEdgeInsetsMake(0, thumb_border, 0, thumb_border);

Code of formating ScrollView in init and resize is this same 在init和resize中格式化ScrollView的代码与此相同

I'm guessing the way you are resizing it is using the 'thumb' variables (_w, _h, _border). 我猜您正在调整大小的方式是使用'thumb'变量(_w,_h,_border)。 Are these being reset after the view is rotated? 旋转视图后是否重置了这些设置? If they are set up to position everything correctly say for portrait view, when you switch to landscape view the sizes will all be wrong won't they? 如果将它们设置为正确放置所有内容以显示纵向视图,那么当您切换到横向视图时,尺寸将全部出错,不是吗? You might have to change those variables? 您可能需要更改这些变量?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM