[英]Set different constraints for iPad in portrait and landscape mode
當設備處於縱向時,我在viewController中有tableView和graphView。 當我更改為橫向模式時,我只想顯示graphView。 我正在使用大小類來做到這一點。 它適用於所有iPhone。
但是對於iPad,縱向和橫向的Size類是相同的(常規寬度和高度)。
我需要為縱向和橫向模式設置不同的約束。當設備處於橫向模式時,如何刪除tableView。
此代碼可以幫助您:
- (void) handleOrientation:(UIInterfaceOrientation) orientation
{
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)
{
//handle the portrait view
}
else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{
//handle the landscape view
//write your code for removing Table
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.