最近在做一个直播app,要求在直播音按返回按钮时直播间不能退出,而是把这个直播间最小化,当最小化时点按钮还能进入直播间,点X关闭,这就要让直播间popViewController的时候,还得保持这个直播间LiveViewController还是存活状态。最后解决办法是把LiveViewController设为一个属性解决的。
#import "LiveViewController.h"
@property (nonatomic, strong)LiveViewController * liveRoomVC;
[self.navigationController pushViewController:self.liveRoomVC animated:YES];
-(LiveViewController *)liveRoomVC
{
if (!_liveRoomVC ) {
_liveRoomVC = [LiveViewController new];
_liveRoomVC .hidesBottomBarWhenPushed = YES;
}
return _liveRoomVC ;
}
//当不需要LiveViewController存活的时候:
self.liveRoomVC = nil;