0

I've got a UITextField added as a subview to a UIWebView that acts as an address bar for a browser. But it's behaving rather strangely, because when the field begins editing the webView automatically scrolls itself to about (-40, 0) and I can't figure out why. I've already tried calling [webView setContentOffset] to counteract this behavior, but that doesn't work for some reason (yes I have the delegate connected). Am I missing something?

stevekohls
  • 2,214
  • 23
  • 29
JohnWickham
  • 571
  • 1
  • 6
  • 15

1 Answers1

0

I hope you have set the delegates for the textfield too, and in delegate method

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

, reset the webview content

[webView setContentOffset] 

I hope this will serve you better.

yunas
  • 4,143
  • 1
  • 32
  • 38