在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
我已經設置了數據源和代理鏈接。
如果用ARC,在頭文件中將MSEmployeeServiceController
設為property。
@property (strong, nonatomic) MSEmployeeServiceController *empServices;
在implementation文件中:
_empServices = [ [MSEmployeeServiceController alloc]initWithNibName:@"MSEmployeeServiceController" bundle:nil];
[self.totScroll addSubview:empServices.view];