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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:30:17+00:00 2026-06-03T10:30:17+00:00

I have an UITableViewController to manage an table view which created with subclassed prototype

  • 0

I have an UITableViewController to manage an table view which created with subclassed prototype cells. The most related codes is as following:

MyCell.h

#import <UIKit/UIKit.h>
@interface ScrollViewTableCellInShorTrip : UITableViewCell
@end

MyCell.m

#import "MyCell.h"
@implementation SMyCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
    // Initialization code
}
return self;
}

- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event 
{   
NSLog(@"touch cell");
[super touchesEnded: touches withEvent: event];

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
}
}
@end

TableViewController.h

#import <UIKit/UIKit.h>

@interface TableViewController : UITableViewController{
}
@property (nonatomic, retain) NSArray *arr;
@end

TableViewController.m

#import "TableViewController.h"
#import "MyCell.h"
@implementation ATripTableViewController
@synthesize arr;

- (void)viewDidLoad
{
[super viewDidLoad];
self.arr = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
CellIdentifier = @"myCell";
MyCell *myCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

return myCell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  [self performSegueWithIdentifier:@"detailView"sender:self];     
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{    
if ([[segue identifier] isEqualToString:@"detailView"]){
   NSLog(@"arr acount is %d", self.arr.count);//program received signal: "EXC_BAD_ACCESS".
}   
}

EXC_BAD_ACCESS error message is appear when calls “NSLog(@”arr acount is %d”, self.arr.count)” in the prepareForSegue:sender: method. It is obviously that the property “arr” is free now. And The situation appears only when i use the subclassed UITableViewCell.

Appreciate any answers!

  • 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-03T10:30:18+00:00Added an answer on June 3, 2026 at 10:30 am

    NSLog(@"arr acount is %d", self.arr.count); replace to NSLog(@"arr acount is %d",arr.count);

    definition of self:
    self is a special variable which is a pointer to the object which received the message which invoked the currently executing method(!). In other words, it is the receiver of the message.

    when you should call self.object rather than calling the object directly within an object.

    self.object = obj;
    object = obj;
    

    The difference between these two calls is that a call to self.object will make use of the accessors generated by the @synthesize directive. A call to the object directly will bypass these accessor methods and directly modify the instance variable

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

Sidebar

Related Questions

I have a UITableViewController, which is RootViewController. It's XIB only has a table view.
I have a UITableViewController that when opened displays a table of the following object:
I have a UITableViewController which creates dynamically re-sizeable cells. The cell changes the size
I have a UITableViewController in my app, which is added to the view hierarchy
I have a UITableViewController with prototype cells containing UITextFields. To configure these custome cells,
I have an UITableViewController which I would like to add UIToolbar to with one
On iOS 5 I Have a UITableViewController set to Static Cells. I only need
I have a regular UITableViewController and a UITableView as its only view, and I
I have created a subclass of UITableViewController that is used as the custom class
I have a UITableViewController which pushes a UIViewController and I need to pass two

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.