I Have a UITableView
with custom cell
with UITextField
and buttons
on that ,my issue is when ever the user selects some textfields
in bottom keybord
is hiding that textfield
, i tried to scroll up the UITableView
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 textFieldDidBeginEditing:
method .textFieldDidBeginEditing:
is also firing and executing the code in that but it is not scrolling up.
- (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];
}