iPhone/iPad鍵盤彈出遮擋要編輯內…
阿新 • • 發佈:2018-12-24
程式碼如下:
- (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];
}