Is it possible to disable Control Center in iOS 7 programmatically and if not, what are alternatives?

后端 未结 3 1050
攒了一身酷
攒了一身酷 2020-11-30 02:28

I have developed an app that uses swipe gesture from bottom up. It was working perfectly in iOS 6, but now iOS 7 came out, and it works maybe 1 out of 25 times: i get iOS 7

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 03:04

    Starting with the iOS 11 SDK (compiled in Xcode 9) additionally to implementing prefersStatusBarHidden:

    Objective-C:

    - (BOOL) prefersStatusBarHidden
    {
        return YES;
    } 
    

    Swift 4+:

    override var prefersStatusBarHidden: Bool { return true }
    

    you also need to implement preferredScreenEdgesDeferringSystemGestures:

    Objective-C:

    - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures{
        return UIRectEdgeAll;
    };
    

    Swift 4+:

    override func preferredScreenEdgesDeferringSystemGestures() -> UIRectEdge {
        return .all
    }
    

    Otherwise the Control/Notification Center appear directly; instead of first showing the gray box with a up/down arrow that needs to be dragged up/down.

提交回复
热议问题