例如,NSString * defaultCellIndentifier = @“HelloWorld”;objective-c何时应该释放静态局部变量
什么时候应该取消分配?字符串是Objective-C中唯一可以变为静态的变量吗?
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[BNUtilitiesQuick UtilitiesQuick].currentBusiness=[[BNUtilitiesQuick getBizs] objectAtIndex:[indexPath row]];
//Business * theBiz=[[BNUtilitiesQuick getBizs] objectAtIndex:[indexPath row]];
static NSString * defaultCellIndentifier = @"HelloWorld";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier: defaultCellIndentifier];
//UITableViewCell*cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Hello"] autorelease];;
...
return cell;
}
那么如果它不是NSString *,但NSDate *看起来像它被取消分配无论如何。只有NSString *可以是静态的,不是吗? – 2011-06-05 11:44:00
@Jim Thio:看到编辑,我希望它解释它。 – DarkDust 2011-06-05 12:01:58