您的位置:首页 > 其它

使用dismissModalViewControllerAnimated 不调用dealloc 内存不释放解决方法

2014-09-17 09:41 507 查看
在ARC项目中使用dismissModalViewControllerAnimated方法隐藏视图时,在dealloc里面打印NSlog检测该控制器有没有释放,结果没有打印出来,经过查找,是由于对这个控制器里面的协议指针赋值,但是这个协议的属性声明的是retain或者strong,要改成
assign。例如:

#import "MonthView.h"
@interface
CalendarController ()<MonthViewDelegate>
@end
引入协议MonthViewDelegate,并在CalendarController
里面赋值[monthView
setManage:self];


@interface MonthView : UIView

@property (nonatomic,strong)
id<MonthViewDelegate> manage;
@end

需要把strong改成assign
;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐