Я пытаюсь создать простое приложение UItableview в проекте, использующем ARC. Таблица выглядит очень хорошо, но если я попытаюсь прокрутить или коснуться ячейки, приложение выйдет из строя.Ошибка UITableView при прокрутке или нажатии - проблема с ARC?
Глядя на NSZombies (это то, что правильный способ сказать, что?) Я получаю сообщение «- [PlacesViewController respondsToSelector]: сообщение, отправленное высвобождены например 0x7c29240»
Я считаю, что это имеет какое-то отношение ARC, поскольку я успешно реализовал UItableviews в прошлом, но это мой первый проект с использованием ARC. Я знаю, что я должен пропустить что-то очень простое.
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
Можем ли мы получить код, который вы используете для выделения, инициализации и хранения вашего PlacesViewController? – hukir