title: How to switch between UIViews in ARC without memory leaks?
body: <p>I use xcode 4.4 with ARC on. I have dynamically created UIViews in the ViewController.m:</p>
  
  <pre><code>UIView* myviews[10];
  </code></pre>
  
  <p>Then in the - (void)viewDidLoad function i fill each of it with pictures i need</p>
  
  <pre><code>myviews[viewIndex] = [[UIView alloc]initWithFrame:myrec];
  UIImage *testImg;
  UIImageView * testImgView = [[UIImageView alloc]init];
  testImg = [UIImage imageNamed:[NSString stringWithFormat:@"imgarray%d.png", viewIndex];
  [testImgView setImage:testImg];
  [myviews[viewIndex] addsubView:testImgView];
  viewindex++;
  </code></pre>
  
  <p>So all seems to be fine, when i want to jump from one view to another i do with two buttons next:</p>
  
  <pre><code>[self.view addSubview:views[viewIndex]];
  CATransition *animation = [CATransition animation];
  [animation setDelegate:self];
  [animation setDuration:1.0f];
  [animation setType:@"rippleEffect"];
  [animation setSubtype:kCATransitionFromTop];
  //[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
  [self.view.layer addAnimation:animation forKey:@"transitionViewAnimation"];
  </code></pre>
  
  <p>Nothing seems to be bad, but the memory consumption grows with huge speed when i switch between views.. and then i get low memory warning or sometimes application will just crash.</p>
  
  <p>I have tried to use UIViewController array and was switching between the controllers: nothing changes, the memory low warning is what i end up with..</p>
  
  <p>Maybe i need to clean the memory somehow? But how? ARC does not allow to use release and so on..</p>
  
  <p>last what i have tried (sorry, maybe not very professional) before to add new subview is this</p>
  
  <pre><code>NSArray *viewsToRemove = [self.view subviews];
                      for (UIView *views in viewsToRemove) {
                          [views removeFromSuperview];
                      }
  </code></pre>
  
  <p>But this does not help either.</p>
  
  <p>EDIT: I need to clarify one thing: i need each UIView during the application execution, this means i can't release it before the application exit.</p>
  
  <p>EDIT2: code is edited to look more alike the real code.</p>