這是我的例子:是更多鈔票具有可變類對象聲明
UITableView *cell = [[MyCustomClass alloc] init];
有沒有辦法做到這一點好歹,我可以改變CLAS「MyCustomClass」,就像這樣的方法:
-(NSObject*)newMethod:(int)intNumber{
classVariable = someClass depending on intNumber
UITableView *cell [[<<<classVariable>>> alloc] init];
return cell;
}
我想這個方法,所以我可以創建正確的自定義細胞,並用它作爲我的下實現一個全球性的方法,這是代碼,我使用,我發現在這裏計算器等問題(使用從xibs加載自定義單元格):
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:stringIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil];
for (id currentObject in nib) {
if ([currentObject isKindOfClass:[UITableViewCell class]]) {
cell = (MyClassCell*) currentObject;
break;
}
}
cell = (MyClassCell *)[nib objectAtIndex:0];
}
我的目標是有一個方法至極我發送的所有信息需求上面的代碼,是至極tableViw,stringidentifier,nibName和MyClassCell < - 是這個問題的全部
其實我的朋友也想要知道如何解決這個問題用在他的一個實現中,我們將非常感謝關於此的任何線索,提前謝謝!