开发者

Custom cell will never be queued when loaded from Nib?

i am using the following logic to load a custom cell into my UITableView:

static NSString* cust=@"CUSTOM"; 
LabelTextfieldTC *cell = (LabelTextfieldTC*)[tableView dequeueReusableCellWithIdentifier:cust];

    if(开发者_开发问答 cell == nil )
    {       
        cell = (LabelTextfieldTC*)[nibs objectAtIndex:0];
    }

but i noticed that with this, dequeueReusableCellWithIdentifier:cust will always return nil and there is no way of reusing queued cells since they have never been queued in the first place. Loading cell from the nib does not tell the framework anything about its identifier "cust". As a result loading from the nib will always take place, and i believe will make things slower somehow. Correct me if am wrong.

I tried to run the nib loading only once at the viewDidLoad function and so that it can be used above instead of doing it everytime but for some reason only the last cell in the table is constructed properly. the others are white.

I hope some one has an insight on this.

Cheers AF


There is a property (Identifier) that you can set in IB on your cell that will be used as its reusableIdentifier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜