Iphone UITableView在从背景显示后消失
我正在尝试创建一个音乐应用程序,上面有一个“正在播放”栏。 我正在为ui使用标准故事板(UITabbarController->UINavigationController->UITableviewcontroller) 当有人点击tableview列表中的轨迹时,一个由程序创建的小uiview会在导航栏下向下滚动,tableview会向下移动 所有这些都很有效 但是,当点击home按钮将应用程序发送到后台并再次打开时,tableview会立即消失。只有在按下Home(主页)按钮锁定iPhone且解锁不会导致任何问题时,才会发生这种情况 这是我在其中设置UIView动画的代码Iphone UITableView在从背景显示后消失,iphone,ios,objective-c,uitableview,uikit,Iphone,Ios,Objective C,Uitableview,Uikit,我正在尝试创建一个音乐应用程序,上面有一个“正在播放”栏。 我正在为ui使用标准故事板(UITabbarController->UINavigationController->UITableviewcontroller) 当有人点击tableview列表中的轨迹时,一个由程序创建的小uiview会在导航栏下向下滚动,tableview会向下移动 所有这些都很有效 但是,当点击home按钮将应用程序发送到后台并再次打开时,tableview会立即消失。只有在按下Home(主页)按钮锁定iPhone
CGRect frame = self.tableView.frame;
frame.origin.y += 60;
frame.size.height -= 60;
if(!nowPlayingPopDown){
//setup nowplaying view
nowPlayingPopDown = [[UIView alloc] initWithFrame:CGRectMake(0, -60, 320, 60)];
CGRect nowPlayingPopDownAnimatedLocation = CGRectMake(0, 0, 320, 60);
nowPlayingPopDown.backgroundColor = [UIColor whiteColor];
[self.view.superview addSubview:nowPlayingPopDown];
//setup waveform background
nowPlayingPopDownWaveformBackground = [[UIView alloc] initWithFrame:CGRectMake(60, 0, 0, 60)];
nowPlayingPopDownWaveformBackground.backgroundColor = [UIColor orangeColor];
[nowPlayingPopDown addSubview:nowPlayingPopDownWaveformBackground];
//setup waveform imageview
nowPlayingPopDownWaveform = [[UIImageView alloc] initWithFrame:CGRectMake(60, 0, 260, 60)];
[nowPlayingPopDown addSubview:nowPlayingPopDownWaveform];
//animate nowplaying bar in
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
self.tableView.frame = frame;
nowPlayingPopDown.frame = nowPlayingPopDownAnimatedLocation;
[UIView commitAnimations];
}
我会在顶部插入一个NSLog来检查tableView.frame。我确信从后台返回时它为零。我刚刚检查过,从后台返回后,frame仍然具有正确的属性。我通过在uiviewcontroller中编程创建tableView来修复它。您找到解决方案了吗?