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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:21:20+00:00 2026-05-23T08:21:20+00:00

in my app i am using an array to print the images in the

  • 0

in my app i am using an array to print the images in the image View present in the table view.The array is used to store the components i entered in the text box,each one separated by space e.g i entered Boy Girl then the array will store Boy as one object and Girl as other and then search the images of each.following is my code:-

-(IBAction)Click
{

    //count = [youSaid.text intValue];
    //count=1;
    //NSArray *sub= [youSaid.text componentsSeparatedByString:@" "];
    j=1;
    sentence=[youSaid.text componentsSeparatedByString:@" "];

    //[substring addObject:youSaid.text];
    [tableView reloadData];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = nil;

    static NSString *AutoCompleteRowIdentifier = @"AutoCompleteRowIdentifier";

    cell = [tableView dequeueReusableCellWithIdentifier:AutoCompleteRowIdentifier];
    if (cell == nil) {

        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:AutoCompleteRowIdentifier] autorelease];
        UIImageView * imageView1 = [[[UIImageView alloc] initWithFrame:CGRectMake(25, 4, 80, 80)] autorelease];
        UIImageView * imageView2 = [[[UIImageView alloc] initWithFrame:CGRectMake(115,4,80, 80)] autorelease];
        UIImageView * imageView3 = [[[UIImageView alloc] initWithFrame:CGRectMake(205,4, 80, 80)] autorelease];
        UIImageView * imageView4 = [[[UIImageView alloc] initWithFrame:CGRectMake(295,4, 80, 80)] autorelease];
        imageView1.tag = j;
        imageView2.tag = j+1;
        imageView3.tag = j+2;
        imageView4.tag = j+3;
        //imageView1.tag=t;
//      t++;
//      imageView2.tag=t;
//      t++;
//      imageView3.tag=t;
//      t++;
//      imageView4.tag=t;
//      t++;

        [cell.contentView addSubview:imageView1];
        [cell.contentView addSubview:imageView2];
        [cell.contentView addSubview:imageView3];
        [cell.contentView addSubview:imageView4];

    }
    //[sentence addObject:@"BLINK"];
    // UIImageView * imageView;
    //for ( int i = 1; i <= j; i++ ) {
        for ( int i = 1; i <= j; i++ ) {
        imageView = (UIImageView *)[cell.contentView viewWithTag:i];

        //button = (UIButton *)[cell.contentView viewWithTag:i];
        imageView.image = nil;

        //[button setImage:nil forState:UIControlStateNormal];
    }


    int photosInRow;
    //NSLog([NSString stringWithFormat:@"%d", [sentence count]]);

    if ( (indexPath.row < [tableView numberOfRowsInSection:indexPath.section] - 1) 
|| ([sentence count] % 4 == 0) ) {

        photosInRow = 4;

    } else {
        photosInRow = [sentence count] % 4;
    }

   // for ( int i = 1; i <= photosInRow; i++ ) 
    for ( int i = 1; i <=[sentence count]; i++ ){
        imageView = (UIImageView *)[cell.contentView viewWithTag:i];

        //button = (UIButton *)[cell.contentView viewWithTag:i];

        [self setImage1:imageView];

        //[self setImage1:button];

        //imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png", i]];

        //imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@.png", youSaid.text]];

                //imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"1.png"]];

    }



    //cell.textLabel.text = [autoCompleteArray objectAtIndex:indexPath.row];
    return cell;
}

I am getting EXC_BAD_ACCESS when i am accessing my array in other method.What colud be the reason for this.Please help.

Thanks,
Christy

  • 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-23T08:21:20+00:00Added an answer on May 23, 2026 at 8:21 am

    Add a retain….

    sentence=[youSaid.text componentsSeparatedByString:@" "];
    [sentence retain];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this code to merge text with an image and it's working fine.
I am using touchBegin and touchMoved in my app. i am setting array of
I am using Android to create a app. Where user answer are store on
I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually
I have an app using PHP and the PayPal API. The basic way it
I'm making an App using Adobe Flex/Air. I was wondering if there is any
I have an app using a ListView as a main screen. Each row displays
I have an iPhone app using a UINavigationController. On the fourth controller of the
I have an app using SQLite3. It's running pretty well, but I would like
I have an app using the ADO.NET entity framework (the VS2008 version, not the

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.