I assume that you are talking about the services "Restful webservice" and "NOT SOAP" for the love of God!
Yes, of course it is . You can follow this approach, I could use HTTP-lib, for example AFNetworking , to make a request, but for simplicity I just init'ing NSData with the contents of the URL in the background and updating the user interface in the main stream using GCD .
Set the UITextField delegate to the ViewController that you are working on the viewDidLoad: method
textField.delegate = self;
override delegate method UITextField textField:shouldChangeCharactersInRange:replacementString: with
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
As you can see, there is a list of concepts that you need to use for:
- JSON parsing (I could parse XML, but why ?! JSON is better!)
- HTTP request (you can use AFNetworking instead of what I did above)
- Asynchronous HTTP requests (do not block the main thread)
- GCD (material
dispatch_async ) - Delegates (in this case for UITextField)
Performance update
- checking if the size exceeds 3 characters, you can even make an HTTP request every 2/3 characters, say, only a request if
length % 3 .
I suggest you read something about these
Carlos Ricardo
source share