我正在使用最新的 SDK 和 XCode 4.5.2 开发 iPhone 应用程序。
在 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,但我不知道我是否可以用静态变量来做到这一点。