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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:56:59+00:00 2026-05-26T04:56:59+00:00

Guys, i thought i found the solution but no…. i making app cont. from

  • 0

Guys, i thought i found the solution but no…. i making app cont. from past 16 hrs, may be that’s y my empty mind is not making any good sound… plz help me..

I am setting Tag to my dynamically generated imageviews and setting tapgestureReconizers on that,tags are given to UITapGestureRecognizer, i want to perform different actions on click on different images, but when ever click on any image it says very silently… 😐 EXC_BAD_ACCESS.
Code: –

#import <UIKit/UIKit.h>

@class AppDelegate_iPhone,Litofinter,ParsingViewController;

@interface FirstViewController : UIViewController<UIGestureRecognizerDelegate>{

    NSMutableArray *array;
    NSString *logoString;
    AppDelegate_iPhone *appDelegate;

    ParsingViewController *obj;

    UIScrollView *scrollView;

    NSMutableArray *idArray;


}
@property (nonatomic,retain)UIScrollView *scrollView;

-(void)onTapImage:(UITapGestureRecognizer *)recognizer;
@end




#import "FirstViewController.h"
#import "AppDelegate_iPhone.h"
#import "Litofinter.h"
#import "ParsingViewController.h"

@implementation FirstViewController

@synthesize scrollView;

-(id)init{
    if(self == [super init]){
        obj = [[ParsingViewController alloc] init];
        array = [[NSArray alloc] initWithArray: obj.LogoMutableArray];
    }
    return self; 
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];

    int x=20,y=10;
    int a=50,b=105;


    appDelegate = (AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate];

    scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0,500, 460)];   
    scrollView.contentSize = CGSizeMake(320,800);
    scrollView.showsVerticalScrollIndicator = YES;

    for (Litofinter *lito in appDelegate.logoArray) {

        NSString * urlString = [lito.cLogo stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
        NSURL * imageURL = [NSURL URLWithString:urlString];

        NSData * imageData = [NSData dataWithContentsOfURL:imageURL];
        UIImage * image = [UIImage imageWithData:imageData];

        UIImageView *imgView = [[UIImageView alloc] initWithImage:image];
        [imgView setFrame:CGRectMake(x, y, 140, 90)];
        imgView.userInteractionEnabled = YES;
        imgView.multipleTouchEnabled = YES;
        imgView.backgroundColor = [UIColor blueColor];
    //  imgView.tag = lito.cId;
    //  NSLog(@"Tag Id = %@",imgView.tag);
        NSLog(@"Tag Id = %@",lito.cId);


        UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapImage:)];
        tgr.delegate = self;
        [imgView addGestureRecognizer:tgr];

        [scrollView addSubview:imgView];

        tgr.view.tag =(int)[NSString stringWithFormat:@"%@",lito.cId];
        NSLog(@"Tag Id = %@",tgr.view.tag);
    //  NSLog(@"Tag Id = %@",lito.cId);



        UILabel *cName = [[UILabel alloc]initWithFrame:CGRectMake(a, b, 130, 20)];
        cName.text = lito.cName;
        [scrollView addSubview:cName];

        //Do the rest of your operations here, don't forget to release the UIImageView
        x = x + 150;
        a = a + 140;

        if(x >300)
        {
            y = y +140;
            x = 20;
            b = b +150;
            a = 50;
        }

        //[tgr release];
        [imgView release];

    }
    [self.view addSubview:scrollView];


}

-(void)onTapImage:(UITapGestureRecognizer *)recognizer;
 {

    NSLog(@"Tapped Image tag: %@", recognizer.view.tag);

    //NSLog(@"Tapped Image Id ======================== %@",scrollView.gestureRecognizers);
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Message from mAc" message:[NSString stringWithFormat:@"Tag Id : %@",recognizer.view.tag] delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok",nil];
    [alert show];
}



- (void)dealloc {
    [super dealloc];
    [scrollView release];
}


@end
  • 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-26T04:57:00+00:00Added an answer on May 26, 2026 at 4:57 am

    This could be due to you trying to log an int as a string in your -(void)onTapImage:(UITapGestureRecognizer *)recognizer selector:

    NSLog(@"Tapped Image tag: %@", recognizer.view.tag);
    

    instead, replace %@ with %i:

    NSLog(@"Tapped Image tag: %i", recognizer.view.tag);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(This is actually a crosspost from gamedev , but I thought you guys and
Hey guys, I thought this would be fairly straightforward, but it's not it seems..maybe
Hey guys, I thought this would be an incredibly simple thing to do, but
hey guys, i found a very intersting website template that has in it's header
Guys, I’ve been writing code for 15+ years, but managed to avoid Web Development
Looked for an answer for this question, but I haven't found a suitable one
Ok guys working on search suggestions using jQuery-UI AutoComplete with results from sql-sever 2008
I'm working as a client-side developer on a web app and found myself having
first of all I'm new to python and programming but you guys already helped
Guys i'm really embaraced to ask for this, but i got stuck and 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.