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