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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:48:45+00:00 2026-05-18T00:48:45+00:00

I have a bissare problem. In the viewDidLoad method of a UITableViewController I have:

  • 0

I have a bissare problem. In the viewDidLoad method of a UITableViewController I have:

myfields = [NSMutableArray array];
    for (int x = 0; x < 10; x++) {
        UITextField * field = [[UITextField alloc] initWithFrame:CGRectMake(130,12,150,25)];
        field.backgroundColor = [UIColor clearColor];
        field.font = [UIFont systemFontOfSize:15];
        field.delegate = [[OptionFieldDelegate alloc] init];
        [myfields addObject: field];
    }
    NSLog(@"myfields array - %@",myfields);

That gives this output:

myfields array - (
    "<UITextField: 0x6a35b50; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a35c60>>",
    "<UITextField: 0x6a36820; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a367f0>>",
    "<UITextField: 0x6a374e0; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a374b0>>",
    "<UITextField: 0x6a382e0; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a382b0>>",
    "<UITextField: 0x6a38ea0; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a38e70>>",
    "<UITextField: 0x6a39950; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a39a60>>",
    "<UITextField: 0x6a3a630; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a3a600>>",
    "<UITextField: 0x6a3b1f0; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a3b1c0>>",
    "<UITextField: 0x6a3bdb0; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a3bd80>>",
    "<UITextField: 0x6a3c970; frame = (130 12; 150 25); clipsToBounds = YES; opaque = NO; layer = <CALayer: 0x6a3c880>>"
)

That’s fine but the next bit isn’t. I don’t touch that array before I need to, yet in the – tableView:cellForRowAtIndexPath: method I have this:

NSLog(@"Array = %@",myfields);
                    NSLog(@"class - %@",NSStringFromClass([myfields class]));
                    NSLog(@"0 - %i",[indexPath row] - 2);
                    NSLog(@"1 - %@",[myfields objectAtIndex:[indexPath row] - 2]);
                    [[cell contentView] addSubview: [myfields objectAtIndex:[indexPath row] - 2]];

This is the output:

2010-11-13 00:58:13.808 Poll Maker[1803:207] Array = <UITableViewCellContentView: 0x6a35b10; frame = (10 1; 300 43); layer = <CALayer: 0x6a3e680>>
2010-11-13 00:58:13.809 Poll Maker[1803:207] class - UITableViewCellContentView
2010-11-13 00:58:13.809 Poll Maker[1803:207] 0 - 0
2010-11-13 00:58:13.810 Poll Maker[1803:207] -[UITableViewCellContentView objectAtIndex:]: unrecognized selector sent to instance 0x6a35b10
2010-11-13 00:58:13.812 Poll Maker[1803:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView objectAtIndex:]: unrecognized selector sent to instance 0x6a35b10'

I am very confused. Can anyone help me? THank you.

  • 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-18T00:48:46+00:00Added an answer on May 18, 2026 at 12:48 am

    You made a memory management mistake. You have to retain the array if you want it to stay around beyond the end of the first method.

    In your case, the memory where the array once was (before it was released by the autorelease pool) got overwritten with a subview of a UITableViewCell.

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

Sidebar

Related Questions

Have such a problem, hope you'll help me.. Can't find anywhere. Here is the
Have an app that can use tts to read text messages. It can also
Have just started to get into CakePHP since a couple of weeks back. I
Have the following code. The height is variable so the height of the floating
Have their been any studies related to the importance of how good a software
Have you any idea how to find out if spell check suggestions dialog is
Have a fun issue with sharepoint calendar view filtering. That code works fine: SPSecurity.RunWithElevatedPrivileges(delegate()
Have a bunch of classes which I need to do serialize and deserialize from/to
Have you ever tried working with a XAML file which contains thousand tons of
Have a xml data like <Items><Item><name>test1</name></Item><Item><name>test2</name></Item></Items> Looks like jaxb cannot unmashall this when defining

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.