Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios willRotateToInterfaceOrientation+;setframe can';t型布局_Ios_Objective C_Rotation_Layoutsubviews - Fatal编程技术网

Ios willRotateToInterfaceOrientation+;setframe can';t型布局

Ios willRotateToInterfaceOrientation+;setframe can';t型布局,ios,objective-c,rotation,layoutsubviews,Ios,Objective C,Rotation,Layoutsubviews,我正在尝试在旋转之前(没有动画,但使用我当时想要的CGRect)和旋转时(使用新的CGRect)更改视图的形状 基本上,iOS不会在“willRotateToOrientation”方法中布局任何内容,即使我尝试使用“self.view LayoutFneed”、“self.view setNeedLayout”、“self.view layoutSubviews”等强制它……) 在使用autolayout时,我尝试不使用SetFrame,而是使用constraint(根本没有更改任何内容)您能

我正在尝试在旋转之前(没有动画,但使用我当时想要的CGRect)和旋转时(使用新的CGRect)更改视图的形状

基本上,iOS不会在“willRotateToOrientation”方法中布局任何内容,即使我尝试使用“self.view LayoutFneed”、“self.view setNeedLayout”、“self.view layoutSubviews”等强制它……)


在使用autolayout时,我尝试不使用SetFrame,而是使用constraint(根本没有更改任何内容)

您能否设置约束,使其在两个方向上都有效?这不是自动布局的一半要点吗?我需要根据两个不同集合视图中的两个单元格更改视图的大小和位置。在旋转之前,我会根据集合视图的偏移量动态选择这两个单元格。自动布局并不是解决这个问题的方法