Guest User

Untitled

a guest
Sep 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. How to assign separate memory spaces of same type of class
  2. add{
  3. UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"pah%d",tagNum]];
  4. TouchImageView *touchImageView = [[TouchImageView alloc] initWithFrame:imageRect];
  5. imageCounter++;
  6. touchImageView.tag = imageCounter;
  7. touchImageView.image = image;
  8. touchImageView.center = CGPointMake(160.0, 230.0);
  9. [view addSubview:touchImageView];
  10. }
  11.  
  12. undo{
  13. [[self.view viewWithTag:imageCounter] removeFromSuperview];
  14. imageCounter--;
  15. }
  16.  
  17. UIImageView *imageView = touchImageView;
  18.  
  19. for(UIImageView *iV in view.subviews)
  20. {
  21. if(iV == imageView)
  22. {
  23. [iV removeFromSuperView];
  24. }
  25. }
Add Comment
Please, Sign In to add comment