Making a UITableView scroll when text field is selected(当TextField被选中的时候,让ScrollView发生滚动)

- (void) textFieldDidBeginEditing:(UITextField *)textField { UITableViewCell *cell; 
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
 // Load resources for iOS 6.1 or earlier
 cell = (UITableViewCell *) textField.superview.superview; } 
else {
 // Load resources for iOS 7 or later 
cell = (UITableViewCell *) textField.superview.superview.superview; 
// TextField -> UITableVieCellContentView -> (in iOS 7!)ScrollView -> Cell! } 
[tView scrollToRowAtIndexPath:[tView indexPathForCell:cell] atScrollPosition:UITableViewScrollPositionTop animated:YES];}```

你可能感兴趣的:(Making a UITableView scroll when text field is selected(当TextField被选中的时候,让ScrollView发生滚动))