0
我創建UITableViewCell,並且當用戶將風景改變爲縱向或縱向時,我試圖檢查相同的代碼,但不自動檢測。如何在設備更改時立即檢測UIInterfaceOrientation方向(人像,風景)
- CellForRowAtIndexPath
{
if (UIDeviceOrientationIsPortrait(self.interfaceOrientation))
{
[Button setFrame:CGRectMake([[UIScreen mainScreen] bounds].size.width - 50, 20, 50, 50)];
}else
{
[Button setFrame:CGRectMake([[UIScreen mainScreen] bounds].size.height - 70, 20, 50, 50)];
}
}
它非常有幫助,我使用didRotateFromInterfaceOrientation:但我必須設置[ self.tableview reloaddata]在此方法中更改位置 – user3377250
請注意設備方向和界面方向之間的差異 – atreat