iphone apps Development help

iphone apps Development help

skipday

New Member
Thread Starter
Joined
Mar 14, 2011
Messages
4
Reaction score
0
[FONT=&quot]Hi All,[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot]I was searching a solution for a UITextField in row under UITableView.[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot]Here is what I want to do. UITextField field should be scroll to top when user clicks on it.[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot]I search Google for the issue and did not find any solution.[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot]Can somebody help me how can I implement scrolling event when particular row is selected?[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot]Thank you in advanced.[/FONT]
 
There is no direct event or class for this action. You need to add some custom code as per below guideline.

1) First of all set tag of UITextField as indexpath.row.
2) In UITableView delegate enable or add method "- (BOOL)textFieldShouldBeginEditing: (UITextField *)textField"
3) Pass tag value of UITextField to below method.
4) - (void) setRowOnTop: (NSNumber*)numRow{
NSInteger iRow = [numRow intValue];
CGRect rowFrame = [tiTableView rectForSection:0];
NSIndexPath *indexPath = [[tiTableView indexPathsForRowsInRect:rowFrame] objectAtIndex:iRow];
[tiTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
:photos:
 
Last edited:
Have a unique idea for an app? There are, as you probably know, a trillion (OK, may not a TRILLION) apps out there. So what makes an app stand out? Why would anyone want to use your app? Why would they pay money for it if you are going to charge?
 
i have extracted an app(sygic)
and there were files and i want to change ( VOICES) i want to make my own Custom Voices.
and do not know how to do that and use what program to do it.
and the files are (alphanumeric.pak) and (navigation.pak)
please help
i want to input my own language
Kurdish Language voice
Thanx for Help
 
To solve your problem you have to maintain an array, with some number(number of textFields you added to all cells) of objects.

While creating that array you need add empty NSString objects to that array. and each time while loading the cell you have to replace the respected object to respected textField.

Check the following code.

- (void)viewDidLoad{
textFieldValuesArray = [[NSMutableArray alloc]init];
for(int i=0; i<numberofRows*numberofSections; i++){
[textFieldValuesArray addObject:@""];
}

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return numberofSections;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return numberofRows;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];

CustomTextField *tf = [[CustomTextField alloc] initWithFrame:CGRectMake(5,5,290,34)];
tf.tag = 1;
[cell.contentView addSubView:tf];
[tf release];
}
CustomTextField *tf = (CustomTextField*)[cell viewWithTag:1];
tf.index = numberofSections*indexPath.section+indexPath.row;
tf.text = [textFieldValuesArray objectAtIndex:tf.index];

return cell;
}

- (void)textFieldDidEndEditing:(UITextField *)textField{

int index = textField.index;
[textFieldValuesArray replaceObjectAtIndex:index withObject:textField.text];
}
 

Latest posts

Back
Top