2
我有一個彈出窗口中顯示的UITableView。我的表格視圖中的一個單元格中有一個UITextField。當正在編輯文本字段(鍵盤可見),我將設備從縱向旋轉到橫向,然後嘗試滾動表格視圖時,它會繼續超出其界限,而不是停止和「反彈」。彈出窗口中的UITableView不停止滾動
有誰知道如何解決這個問題?
我有一個彈出窗口中顯示的UITableView。我的表格視圖中的一個單元格中有一個UITextField。當正在編輯文本字段(鍵盤可見),我將設備從縱向旋轉到橫向,然後嘗試滾動表格視圖時,它會繼續超出其界限,而不是停止和「反彈」。彈出窗口中的UITableView不停止滾動
有誰知道如何解決這個問題?
您可以嘗試檢測設備何時旋轉,並調用tableViewController方法,以將選定單元格的滾動位置調整到所需的區域。
您可以使用下面的代碼時,旋轉裝置
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if ([appDelegate.aPopover isPopoverVisible])
{
[appDelegate.aPopover dismissPopoverAnimated:NO];
CGSize size = [self rotatedSize];
size.height -= [[self.view viewWithTag:154] frame].size.height;
appDelegate.aPopover.popoverContentSize = size;
[appDelegate.aPopover presentPopoverFromRect:[[self.view viewWithTag:154] frame]
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
}
}
// for set popoverview size when rotate screen
-(CGSize)rotatedSize
{
UIDeviceOrientation orientation1 = [[UIDevice currentDevice] orientation];
UIInterfaceOrientation toInterfaceOrientation = orientation1;
if ((toInterfaceOrientation == UIInterfaceOrientationPortrait) || (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
{
return self.view.frame.size;
}
else
{
return CGSizeMake(self.view.frame.size.height, self.view.frame.size.width);
}
}
謝謝
這是一個很大的代碼,東西告訴我有一個簡單的方法:) – logancautrell 2010-09-14 14:30:44