创建一个类,添加到当前视图中,然后释放:
TestViewController *tView=[[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
tView.view.frame=CGRectMake(10, 10,tView.view.frame.size.width , tView.view.frame.size.height);
[self.view addSubview:tView.view];
[tView release];
添加按钮到TestViewController,然后按按钮时,就崩溃了。控制台的信息:
-[TestViewController performSelector:withObject:withObject:]: message sent to deallocated instance