views:

18

answers:

1

Hi , i am trying to implement something that user can insert an number then program show me the row number but i little bit confusing , i would be grateful if you help me , here is my code :

for(int i = 0; i < myTextField.text; i++) {
[myScrollTable selectRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0 ] animated:YES scrollPosition:UITableViewScrollPositionTop];

the compiler shows me a Warning and app crashes what can i do to equal my UtextField with indexPathForRow ?

warning alert: comparison between pointer and integer

+1  A: 

You need to convert the textfield value to an int. That's what the compiler is warning you about.

for(int i = 0; i < [myTextField.text intValue]; i++) { ...

Not sure why you're using a loop if you only want to scroll to the row. Use scrollToRowAtIndexPath:atScrollPosition:animated: (Reference Doc)1

Jason Harwig
thanks works great , i have 494 rows , and have big problem with UISearchBar , your code works great but but if i insert big number like 389 , doesn't scroll !
Momeks
i change animate:NO , and works fine :-?
Momeks