Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

UITableView crash on scroll or tap - issue with ARC?

mediaspreemediaspree Posts: 525Registered Users
I am trying to create a simple UItableview app in a project utilizing ARC. The table renders just fine but if I try to scroll or tap a cell the app crashes.

Looking at the NSZombies (is that the proper way to say that?) I get the message "-[PlacesViewController respondsToSelector:]: message sent to deallocated instance 0x7c29240"

I believe this has something to do with ARC as I have successfully implemented UItableviews in the past but this is my first project using ARC. I know I must be missing something very simple.

PlacesTableViewController.h
@interface PlacesViewController : UIViewController
<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *myTableView;

@end


PlacesTableViewController.m

#import \"PlacesTableViewController.h\"

@implementation PlacesViewController

@synthesize myTableView;
- (void)viewDidLoad
{
[super viewDidLoad];

self.myTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];

self.myTableView.dataSource = self;
self.myTableView.delegate = self;

[self.view addSubview:self.myTableView];
}
#pragma mark - UIViewTable DataSource methods

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 100;
}



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

static NSString *CellIdentifier = @\"MyTableViewCellId\";

result = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if(result == nil)
{
result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

result.textLabel.text = [NSString stringWithFormat:@\"Cell %ld\",(long)indexPath.row];


return result;
}
@end
Post edited by mediaspree on

Replies

Sign In or Register to comment.