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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:10:30+00:00 2026-05-21T05:10:30+00:00

Sorry for the messy title, I just don’t know how to describe the problem

  • 0

Sorry for the messy title, I just don’t know how to describe the problem in a delicate way.

I’m writing a album-like app to display a bunch of image in my scrollview and do something when a image is touched.

I followed this question : how can i detect the touch event of an UIImageView and use button with background image to handle touch event.

My original method is using NSOperation to concurrently fetch image from internet and put it io a imageview and add to my scrollview, and the speed is quite ok because each imageview shows right after each NSOperation callback.

Then I change imageview to uibutton, the strange thing is that when a NSOperation callback, that button does not show in my view. They show up at once when all the NSOperation callback is done. That makes the user experience become unacceptable.

This is my NSOperation callback function, it will pass a button that contains the image fetched from internet

- (void)imageLoaded:(UIButton*)button;
{
    NSLog(@"Done");
    [button addTarget:self action:@selector(buttonPressed:) 
     forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}

The buttons will only displa after the last “Done” appear instead of one by one, is that normal? or I messed up something?

==== update ========

I think I’m running the NSOperation on my viewcontroller. I have a imageLoadOperation class, I’ll pass my viewcontroller to it

imageLoadOperation *ilo = [[imageLoadOperation alloc] initWithURLString:[NSString stringWithFormat:@"link for the image"];
[ilo setParent:self];
[queue addOperation:ilo];
[ilo release];

And in the main function of imageLoadOperation I’ll do

[parentViewController performSelectorOnMainThread:@selector(imageLoaded:) withObject:button waitUntilDone:NO];

Do you mean I need to move these code to my AppDelegate instead of running in my viewcontrollor?

  • 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-21T05:10:31+00:00Added an answer on May 21, 2026 at 5:10 am

    You can use a button of custom type over your image view instead of using button with background image, or you can use touch event on an UIImageView

    • (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for messy title, if you are a moderator and know a better title,
I know the title is vague, sorry I couldn't think of a better way
Sorry for a long question and not a very descriptive title, but my problem
Sorry. I'm just bitten (or bit. Go figure with this left-to-right language :-) I've
Sorry for the unhelpful title, but hopefully I can explain this well enough. Lets
Sorry if the title doesn't make sense. Basically I have a series of strings
Sorry for the wordy title - I am battling to work out if my
[Sorry about a messy question. I believe I am targeting .Net 2.0 (for now)]
Sorry.. my english is so bad :'( I wrote a messy xaml codes <ScrollViewer>
sorry if the title is a little.. vague i couldnt pin it down. So

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.