Is it possible to create a hidden UIWebView programmatically and then release it(destroy it completely deallocating all of it’s memory) when I have used it? If so, could you give some tips. Thanks!
Is it possible to create a hidden UIWebView programmatically and then release it(destroy it
Share
It seems odd that you want to use a hidden
UIWebViewobject for some task when the main purpose of anUIWebViewobject is to present the html content. The answer to your question is yes. You can create them and remove them programmatically just like any other view as @Nil has mentioned but it seems your main purpose behind this is to get the content. If that’s so, you have many other ways you can get that content without having to create aUIWebViewobject. You can useNSString‘sinitWithContentsOfURL:encoding:error:method to get the contents of the url into a string which you can parse and use.NSDatahas a similar method. However to use these you will have to perform them in the background otherwise they will block the main thread. The most obvious and better way would be to useNSURLConnectionor its popular counterpartASIHTTPRequest.