1. 程式人生 > >iPhone/iPad鍵盤彈出遮擋要編輯內…

iPhone/iPad鍵盤彈出遮擋要編輯內…


程式碼如下:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 OrderNumViewController *orderNumViewController = [[OrderNumViewController alloc] init];
 orderNumViewController.containerViewController = self;
 if (orderNumPopover == nil) {
  orderNumPopover = [[UIPopoverController alloc] initWithContentViewController:orderNumViewController];
 }else {
  orderNumPopover.contentViewController = orderNumViewController;
 }
 
 OrderOnlineCell *cell = (OrderOnlineCell *)[tableView cellForRowAtIndexPath:indexPath];
 NSArray *indexArray = [tableView indexPathsForVisibleRows];
 BOOL upHalf = true;
 int halfIndex = indexArray.count / 4;
 if (indexPath.row > [[indexArray objectAtIndex:halfIndex] row]) {
  upHalf = false;
 }
 [self showOrderNumPopover:cell isUpHalf:upHalf];
 [orderNumViewController release];
}