Note that there are some explanatory texts on larger screens.

plurals
  1. POReceived memory warning when loading uibweview
    primarykey
    data
    text
    <p>I have a method that load some youtube videos in a UIWebview and i have lots of videos and when i am running the code i am getting <strong>Received memory warning</strong> and app get crashed. I tried to fix it using <code>did received memory waring</code> but its not working this is the method that i am using :-</p> <pre><code>-(void) setScrollView:(UIScrollView *)scrollview :(NSArray *)contentArray{ int x=0; for(NSDictionary *str in contentArray){ UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(x, 0, 123, 123)]; webView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; webView.scrollView.scrollEnabled = NO; webView.scrollView.bounces = NO; NSString *link = [str objectForKey:@"UTUBEURL"]; link = [@"http://www.youtube.com/v/" stringByAppendingFormat:link]; NSLog(@"link = %@",link); NSString *embedHTML = @"\ &lt;html&gt;&lt;head&gt;&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0 \"&gt;\ &lt;style type=\"text/css\"&gt;\ body {\ background-color: transparent;\ color: white;\ }\ &lt;/style&gt;\ &lt;/head&gt;&lt;body width=\"%0.0f\" height=\"%0.0f\" style=\"margin:0\"&gt;\ &lt;embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \ width=\"%0.0f\" height=\"%0.0f\" autostart=\"true\"&gt;&lt;/embed&gt;\ &lt;/body&gt;&lt;/html&gt;"; NSString* html = [NSString stringWithFormat:embedHTML,webView.frame.size.width, webView.frame.size.height,link, webView.frame.size.width, webView.frame.size.height]; [webView loadHTMLString:html baseURL:nil]; UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(x,123,200,20)]; [title setFont:[UIFont systemFontOfSize:11]]; [title setBackgroundColor:[UIColor blackColor]]; [title setTextColor:[UIColor whiteColor]]; title.text = [NSString stringWithFormat:@" %@",[str objectForKey:@"DISPLAYTEXT"]]; x += webView.frame.size.width+2; [scrollview addSubview:webView]; [scrollview addSubview:title]; } scrollview.contentSize = CGSizeMake(x, scrollview.frame.size.height); } </code></pre> <p>i am having about 50 videos here so what can i do to avoid this i am calling this method in side my <strong>viewDidLoad</strong>. Is there a way to do this better using a thread, can someone help me with this? but i dont have any knowledge on thread on ios.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload