通话时如何管理应用程序视图?

问题描述 投票:0回答:1

在我的 iOS 应用程序中,当用户参加通话并最小化通话以使用我的应用程序时,它会在状态栏中显示正在进行的通话,并将我的应用程序向下移动近 20 像素。有没有办法将当时的应用程序视图大小缩短 20px 并在通话结束时恢复它? enter image description here

ios objective-c iphone statusbar
1个回答
1
投票

您可以使用应用程序通知来相应地调整视图的框架。只需为

UIApplicationWillChangeStatusBarFrameNotification
UIApplicationDidChangeStatusBarFrameNotification
通知添加观察者,当调用它们时,从通知对象获取状态栏框架,如下所示:

- (void)statisBarFrameWillChange:(NSNotification *)note {
    NSValue *newFrameValue = [note userInfo][UIApplicationStatusBarFrameUserInfoKey];
    //change view's frame here
}

并更改框架。

© www.soinside.com 2019 - 2024. All rights reserved.