Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 898191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:00:20+00:00 2026-05-15T15:00:20+00:00

wat i am trying to is, each time user touches screen, i am adding

  • 0

wat i am trying to is, each time user touches screen, i am adding a small bulletr image on screen

UIImage *img = [UIImage imageNamed:@"shoot_a.png"]; //bullet shot image
        im.image = img;
[self.view addSubview:im];

, if user touches 50 times, there will be 50 images on screen.

now i want, if user hit a button, all these bullet should be remove from the screen.

i hope i am clear about my question.

[im removefromsuperview] doesnt work for me.

if i want to add images to array at run time, how can i add and release?
or is there any better way to clear all images
regards.


this is my touch method, i m adding bullet images on screen frm heere,, but these images are not getting added in Array

// Touch method
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    if(restrictTap == YES){



    NSUInteger numTaps = [[touches anyObject] tapCount];
    NSString *numTapsMessage = [[NSString alloc] initWithFormat:@"%i", numTaps];
        [numTapsMessage release];
    // getting location
    CGPoint touchLocation = [[touches anyObject] locationInView:self.view];
    NSString *locationMessage = [[NSString alloc] initWithFormat:@"Location: X = %.0f Y = %.0f", touchLocation.x, touchLocation.y];
        //bullet shot  image
        im = [[UIImageView alloc] initWithFrame:CGRectMake(self.location.x, self.location.y, 12.0, 12.0)];

        float j =self.location.x;
        float i =self.location.y;

        img = [UIImage imageNamed:@"shoot_a.png"]; //bullet shot image
        im.image = img;
         //im.hidden = NO;
        [self.view addSubview:im]; ///bullet shot image is over transparent view            

        [imageArray addObject:img];



}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:00:21+00:00Added an answer on May 15, 2026 at 3:00 pm

    You could keep track of them via a NSMutableArray property and use that to remove them:

    // create e.g. in initializer:
    imageArray = [[NSMutableArray alloc] init];
    
    // clean-up, e.g. in dealloc:
    self.imageArray = nil;
    
    // add image:
    [imageArray addObject:im];
    
    // remove all:
    for (UIView *img in imageArray) {
        [img removeFromSuperview];
    }
    [imageArray removeAllObjects];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following class [XmlRoot(ElementName= webSites)] //No capital w at the beginning public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.