1
我试图展现一个UIView子类:UIView子类,之前发布加载它?
-(void)pushChatNewMessage:(id)sender
{
NSNotification *not = (NSNotification *)sender;
NSNumber *num = (NSNumber *)not.object;
OTChatMessageBox *chatMessageBox = [[OTChatMessageBox alloc] init];
chatMessageBox.frame = CGRectMake(123, 60, 778, 208);
chatMessageBox.toId = [num intValue];
[UIView beginAnimations:@"animationChatBox" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:chatMessageBox cache:YES];
[self.view addSubview:chatMessageBox];
[UIView commitAnimations];
[chatMessageBox release];
}
的问题是,我得到这个错误:
modifiying layer that is being finalized
我在调试观察到OTChatMessageBox对象的dealloc方法被称为只是结束这种方法。
如果我删除的对象的发布,一切工作正常...有一个伟大的泄漏...
我回顾OTChatMessageBox的init()方法是绝对简单,只有一个TextView对象,并用一个按钮通知电话。
我失踪了什么?
预先感谢;)
- 编辑 -
-(id)init
{
self = [super init];
if (self)
{
self = [[[NSBundle mainBundle] loadNibNamed:@"OTChatMessageBox" owner:self options:nil] objectAtIndex:0];
[txtMessage becomeFirstResponder];
}
return self;
}
我们可以看到'OTChatMessageBox' – 2012-03-04 00:07:02
确保'init'方法! :)但我认为是正确的吗? – NemeSys 2012-03-04 00:47:39