I am making a REALLY BASIC UITableView
project without any data source. I am just displaying "1" on first and only cell.
I am returning 1
in both numberOfSectionsInTableView
and numberOfRowsInSection
. I am also doing an NSLog
on both methods simply stating the name of the respective methods.
On initial load, I get this:
SomeShit[27511:936083] number of sections
SomeShit[27511:936083] number of rows in section
SomeShit[27511:936083] number of sections
SomeShit[27511:936083] number of rows in section
SomeShit[27511:936083] number of sections
SomeShit[27511:936083] number of rows in section
Why are these methods calling thrice? Correct me if I am wrong but this is really weird. I thought they were supposed to call only once because of number of items in both being just 1.
EDIT:
What I am doing in viewDidLoad
,
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
[self.view addSubview:self.tableView];
self.tableView.dataSource = self;
self.tableView.delegate = self;
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellIdentifier];