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

  • Home
  • SEARCH
  • 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 8260391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:05:22+00:00 2026-06-08T03:05:22+00:00

I wanna to create dynamically UIImageView on every tap on main view and also

  • 0

I wanna to create dynamically UIImageView on every tap on main view and also wanna to move all the created UIImageView by finger movement.I’ve got success to dynamic creation on every touch my code is below :

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch *touch = [touches anyObject];
    CGPoint pt = [touch locationInView:self.view];

    imgView = [[[UIImageView alloc] initWithFrame:CGRectMake(pt.x,pt.y, 100, 100)] autorelease];
    imgFilepath = [[NSBundle mainBundle] pathForResource:@"img" ofType:@"png"];
    img = [[UIImage alloc] initWithContentsOfFile:imgFilepath];
    imgView.tag=i;  
    [imgView setImage:img];
    [img release];
    [self.view addSubview:imgView];
}  

Now I wanna to move any of the dynamically created UIImageView by finger movement on it.
Thanks.

  • 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-06-08T03:05:23+00:00Added an answer on June 8, 2026 at 3:05 am

    Set the userInteractionEnabled property of the UIImageView to yes in the method you create it (i. e. the method you posted):

    imgView.userInteractionEnabled = YES;
    

    then you will most probably need to subclass UIImageView and implement the following methods to move your image view around:

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
    

    Hint: in the touchesMoved: etc. method, you’ll want to track where the user’s finger moved — after reading some more docs you’ll most probably end up using -[UITouch locationInView:] — you’ll need to convert the coordinates to the superview of your image view and then move the image view itself in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got collection of words, and i wanna create collection from this collection limited
I got some trouble with the TableLayout Android. I wanna create a table with
I have create several canvas with transparent background and wanna make some move event
Hello all I wanna create a ASP.NET c# file named DBconnect.aspx where I will
i've got 2 tables: Seat(roomID,seatID,...) SeatState(roomID,seatID,date,state) i wanna create a seat class and i
I wanna create a batch file that could do something to all folder in
I wanna create an anonymous type that I can set the property name dynamically.
I wanna create an app that will have three view controllers. To navigate between
i wanna create a simple bookmarklet that hides all images from the current website
I wanna create a public repo (bare repo) which contains multiple submodules. I want

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.