0

在我的 UIViewController 中,我添加了一个包含 uitableview 的子视图。

MSEmployeeServiceController *empServices = [[MSEmployeeServiceController alloc]initWithNibName:@"MSEmployeeServiceController" bundle:nil];
[self.totScroll addSubview:empServices.view];

MSEmployeeServiceController类包含一个UITableView. 当我尝试添加视图应用程序时崩溃并出现以下错误:

-[MSEmployeeServiceController numberOfSectionsInTableView:]: message sent to deallocated instance 0x8684030

我已经在视图中设置了数据源和委托连接。请帮我。

4

1 回答 1

2

如果您使用ARC ,请在头文件MSEmployeeServiceController中创建这样的属性对象

@property (strong, nonatomic)  MSEmployeeServiceController *empServices;

然后在你的实现文件中,

_empServices = [[MSEmployeeServiceController alloc]initWithNibName:@"MSEmployeeServiceController" bundle:nil];

[self.totScroll addSubview:empServices.view];
于 2013-07-31T10:18:12.897 回答