Waitak Jong Waitak Jong - 1 year ago 90
iOS Question

I uitableview the (cell = nil) always not call?

in the ui tableview cell,
the statement if (cell == nil) is not called.

Because when i initialize the cell outside the if statement, the talbe will have some wrong label in wrong row.

how can I initialize my cell?

The @"tttestttt" NS LOG is not all the time when the table is created.

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *MyIdentifier = @"GroupsCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];


Answer Source

dequeueReusableCellWithIdentifier: always return a cell if you're using Storyboard.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download