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 8809547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:54:11+00:00 2026-06-14T02:54:11+00:00

I did weeks of searching and finally found an example on Github that suited

  • 0

I did weeks of searching and finally found an example on Github that suited my needs. It was a trash drag example. I have now edited the example to my needs.

I now have only one problem. in my Scrollview I have 5 images, but they are all the same.

I want to know how to make each thumbnail a different image so when i drag an image from the Scrollview to the Imageview at the top it changes to that image i dragged form the scrollview.

Basically I want different images in my scrollview not all the same like I have.

I’m almost there and I got stuck on this one last thing I need to complete my battle.

As always any assistance would be much appreciated , below are some sample images and a link to my sample project.

Thank you.

MySampleProject

enter image description here
enter image description here
enter image description here

  • 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-14T02:54:14+00:00Added an answer on June 14, 2026 at 2:54 am

    This is what I did:

    One. Rewrite the - initWithFrame: method of the GalleryButton class like this:

    - (id)initWithFrame:(CGRect)frame imageName:(NSString *)imgName
    {
        self = [super initWithFrame:frame];
        if (self) {
            isInScrollview  = YES;
    
            CGRect myImageRect = CGRectMake(0, 0, 64, 64);
            images = [[UIImageView alloc] initWithFrame:myImageRect];
    
            // here's the change:
            // instead of a constant name, use the `imgName` parameter
            [images setImage:[UIImage imageNamed:imgName]];
            [self addSubview:images];
    
            self.backgroundColor = [UIColor blackColor];
            self.layer.borderWidth = 2;
            self.layer.borderColor = [UIColor blackColor].CGColor;
            self.layer.masksToBounds = YES;
            self.layer.cornerRadius = 5;
        }
        return self;
    }
    

    Then, rewrite the - addAttachment: method of the GalleryScrollView class like this:

    - (void) addAttachment:(AttachmentItem *)attachment withImageNamed:(NSString *)imgName
    {
        // everything stays the same (!), except this line:
        GalleryButton *btnAttachment = [[GalleryButton alloc] initWithFrame:CGRectMake(startX, startY, width, height)];
        // is to be extended to:
        GalleryButton *btnAttachment = [[GalleryButton alloc] initWithFrame:CGRectMake(startX, startY, width, height) imageName:imgName];
        ...
    }
    

    Then, in - [HegakaDragAndDropRecycleBinViewController viewDidLoad], specify the filenames of the images you want to use:

    [self.gallery addAttachment:item withImageNamed:@"recyclebin"];
    [self.gallery addAttachment:item withImageNamed:@"canadian-maple"];
    [self.gallery addAttachment:item withImageNamed:@"light-cherry"];
    [self.gallery addAttachment:item withImageNamed:@"mozambique-wenge"];
    [self.gallery addAttachment:item withImageNamed:@"canadian-maple"];
    

    Result:

    enter image description here

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

Sidebar

Related Questions

I have an old commit that I did a few weeks ago. I want
Did about 30 minutes worth of searching, found lots of relevant info, but none
I have not used my Visual Studio 2010 for 2 weeks. Did not even
Did some searches here & on the 'net and haven't found a good answer
Did you ever have the following situation: you need to store information, but a
Did not have luck with these examples: Javascript File remove Javascript FSO DeleteFile Method
Did actually someone make already a tutorial that shows how to customize an UITableView?
Did any one have luck recently register Visual studio 2008 express C# product? Look
I have a project i've been working on that requires me to retrieve the
I need to look at the commit i did few weeks ago e.g. when

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.