小编MDM*_*nty的帖子

NSNotification是否保留对象?

我的问题是关于添加到-postNotificationName:object: userInfo:方法的对象.

NSNotification是否保留对象? (与NSMutableDictionary或Array类似)...意味着我可以在发布通知后释放该对象

下面是一个代码片段,用于帮助描述我的问题......释放对象是否有效.Apple文档的链接可能非常有用.

NSMutableDictionary *teamDictCopy = [self.teamDict mutableCopy];
[teamDictCopy setObject:[NSNumber numberWithInt:self.scrollViewIndex] forKey:@"imageIndex"];

if([self.statusButton.title isEqualToString:@"Completed"]){
    [[NSNotificationCenter defaultCenter] postNotificationName:@"UnComplete" object:teamDictCopy userInfo:nil];
}

[teamDictCopy release];
Run Code Online (Sandbox Code Playgroud)

iphone nsnotifications nsnotification ios

21
推荐指数
2
解决办法
5859
查看次数

标签 统计

ios ×1

iphone ×1

nsnotification ×1

nsnotifications ×1