我正在開發一個iPhone應用程序與最新的SDK和XCode 4.5.2。相同的UITableViewDataSource爲兩個UITableView
在ViewController上我有兩個UITableView
。兩者使用相同的UITableViewDataSource
。我的問題是關於static NSString* CellIdentifier;
。
我可以做以下嗎?
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* CellIdentifier;
SingletonGlobalVars* singleton = [SingletonGlobalVars sharedInstance];
if ([tableView isEqual:shopsList])
{
CellIdentifier = @"ShopCell";
}
else
{
CellIdentifier = @"ProductCell";
}
[ ... ]
}
我需要改變CellIdentifier
,但我不知道如果我能做到這一點與一個靜態變量。
設定每個實現代碼如下對象兩個不同的標記,並檢查代碼。願這爲你工作。 – Exploring