ios - 不同的横向和纵向设计
<p><p>您好,我有我的应用的纵向设计,我想在用户旋转设备时更改此设计。</p>
<p>类似的东西:</p>
<p>肖像:</p>
<p><strong>按钮 1 - 按钮 2</strong></p>
<p><strong>按钮 3 - 按钮 4</strong></p>
<p>风景:</p>
<p><strong>按钮 1 - 按钮 2 - 按钮 3 - 按钮 4</strong></p>
<p>不知道下一个方法是不是最好:</p>
<pre><code>[ addObserver:self
selector:@selector(didRotate:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
- (void) didRotate:(NSNotification *)notification{
UIDeviceOrientation orientation = [ orientation];
if (orientation == UIDeviceOrientationLandscapeLeft) {
HERE CHANGE THE CONSTRAINS
}
}
</code></pre>
<p>谢谢大家。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><pre><code>You can do this with using Size Class. i did this...
1. First Desigh Screen in wAny - hAny and set all Constrains
2. For Portrait select wCompact - hRegular and go to Size inspector
3. In Descendant Constrains there are many Constrains select one by one (double click on that)
4. you can see two + button. perss it and select wCompact - hRegular. it shownew field set Constrains (Size). do this for all Constrains.
5. Now for Landscape in storybord select wRegular - hCompact and do this same...
</code></pre>
<p>它就像 if - else if 条件... if (Portrait){ this } else if (Landscape) { this }</p></p>
<p style="font-size: 20px;">关于ios - 不同的横向和纵向设计,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/31697276/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/31697276/
</a>
</p>
页:
[1]