Note that there are some explanatory texts on larger screens.

plurals
  1. POscroll table view top when selecting an textfield
    text
    copied!<p>I Have a <code>UITableView</code> with custom <code>cell</code> with <code>UITextField</code> and <code>buttons</code> on that ,my issue is when ever the user selects some <code>textfields</code> in bottom <code>keybord</code> is hiding that <code>textfield</code> , i tried to scroll up the <code>UITableView</code> by seeing some answers in stackoverflow. but it is not scrolling can any one help me in finding out the mistake made by me please.i have written code for scrolling in <code>textFieldDidBeginEditing:</code> method .<code>textFieldDidBeginEditing:</code> is also firing and executing the code in that but it is not scrolling up.</p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; { // NSLog(@"No OF rows:%d",[contents count]); return [contents count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; { static NSString *cellIdentifier = @"cell"; // Try to retrieve from the table view a now-unused cell with the given identifier. cell = (uploadCustomCell *)[tableView dequeueReusableCellWithIdentifier:@"uploadCustomCell"]; if (cell == nil) { cell = [[uploadCustomCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"uploadCustomCell"]; NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"uploadCustomCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; } saveBtnCcell.hidden = YES; cell.textNamefield.hidden = YES; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; [cell.defaultSwitch setEnabled:NO]; dictionaryContents = [contents objectAtIndex:indexPath.row]; cell .nameLabelCell.text = [dictionaryContents valueForKey:@"VideoName"]; cell.userName.text = [dictionaryContents valueForKey:@"User"]; cell.thumbImg.image = [arrayimage objectAtIndex:indexPath.row]; NSString *defaultVideo = [dictionaryContents valueForKey:@"DefaultVideo"]; if ([defaultVideo isEqual: @"1"]) { [defaultSwitche setOn:YES animated:YES]; } else{ [defaultSwitche setOn:NO animated:YES]; } [cell.defaultSwitch addTarget:self action:@selector(setState:)forControlEvents:UIControlEventValueChanged]; VideoNameTextField.hidden = YES; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 207; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ // selectedRow=indexPath.row; indexpathTest = indexPath.row; [tabelView1 reloadData]; NSMutableArray *dictionary = [contents objectAtIndex:indexPath.row]; guid = [dictionary valueForKey:@"GUID"]; detailsVehImg.image = [arrayimage objectAtIndex:indexPath.row];; } - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; { return UITableViewCellEditingStyleDelete; } - (void)textFieldDidBeginEditing:(UITextField *)textField { [self.tabelView1 scrollToRowAtIndexPath:1 atScrollPosition:UITableViewScrollPositionTop animated:YES]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload