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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:04:36+00:00 2026-06-10T08:04:36+00:00

Actually ,I’ve been looking around at how to call a method from a block.

  • 0

Actually ,I’ve been looking around at how to call a method from a block.
I am trying to fetch all images from iphone photo app .Here is the code….

void (^assetGroupEnumerator)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop)   
     if(group != nil) {
        [self.groups addObject:group];
        [group enumerateAssetsUsingBlock:selectionBlock];
    }
};

[library enumerateGroupsWithTypes:groupTypes
                  usingBlock:assetGroupEnumerator
                failureBlock:^(NSError *error) {NSLog(@"A problem occurred");}];

In selectionBlock … I just want to add an action when user click on any image.
so I tried this code ..

[imgView addTarget:self action:@selector(buttonPressed) forControlEvents:UIControlEventTouchUpInside];

buttonPressed is also defined in the same .m file.

- (void) buttonPressed: (id) sender {
UIAlertView* av = [[UIAlertView alloc] initWithTitle:@"Howdy!"
                                             message:@"You tapped me."
                                            delegate:nil
                                   cancelButtonTitle:@"Cool"
                                   otherButtonTitles:nil];
[av show];
}

But in selectionBlock I am getting “No visible @interface for ‘UIImageView’ declares the selector ‘addTarget:action:forControlEvents’ “

I am new to iOS programming. so any help would be very, very appreciated!

  • 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-10T08:04:38+00:00Added an answer on June 10, 2026 at 8:04 am

    -addTarget:action:forControlEvents: is a method on UIControl. UIButton, UISwitch, and so on are all subclasses of UIControl. UIImageView, however, is not, so it does not respond to that selector. Since your imgView variable is a UIImageView, the compiler won’t let you call this method on it. This has nothing to do with calling it in from a block, btw – but only with what methods objects declare they respond to.

    Hope this helps!

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

Sidebar

Related Questions

Actually i am creating an application in which i want to load images from
Actually i'm trying to show and dialog into a parent form, An reference example
Actually i am unable to access internet in android emulator. when i am trying
Actually, if you use a method with new, create, alloc or copy in it's
Actually i am testing a sample application in iPhone...where in user interface if i
Actually my question is all in the title. Anyway: I have a class and
Actually not sure on the terminology of what I'm trying to do. I have
Actually what I am looking for loading is loading the page first and then
Actually what i am trying to build is like a kind of firewall. It
Actually I am trying to move some box alternatively with in another box. I

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.