开发者

equaling indexPathForRow with UItextField

开发者 https://www.devze.com 2023-01-18 12:24 出处:网络
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 :

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 scrollP开发者_开发百科osition: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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消