旋轉設備時,我的應用程序出現問題。 tableView擴展到設備視圖,導致它無法訪問。設備旋轉時調整tableView的大小
我怎樣才能得到表來調整因此這將不會發生呢?
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
NSLog(@"Device is rotated sidewise");
myTable.delegate = self;
myTable.dataSource = self;
myTable.scrollEnabled = YES;
[self.view addSubview:myTable];
myTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 148, 320, 10)];
}
}
在編碼xcode或objective-c時,我是一個完整的noob。我目前正在研究這個問題,所以請對你的答案保持友好。
谷歌'autolayout'或' viewresizing masks'在iOS中 – Shubhank