Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Memory leak while using uilable in for loop [closed]
  2. for (int i = 0; i < 1000; i++) {
  3.         UILabel *theLabel = [[UILabel alloc]init];
  4.         theLabel.text = @"Something";
  5.         [self.view addSubview:theLabel];
  6.         [theLabel release];
  7. }
  8.        
  9. for (int i = 0; i < 1000; i++) {
  10.         @autoreleasepool {
  11.             NSString *thisString = @"something";
  12.             theLabel.text = theString;
  13.         }
  14. }