Disabling user interaction of the current view on screen

前端 未结 7 644
一个人的身影
一个人的身影 2021-01-31 02:52

My app has many views and their respective controllers. Now I have a set of model classes with business logic in them. One of the model classes(subclass of NSObject) has the res

7条回答
  •  时光取名叫无心
    2021-01-31 03:38

    Use following code for disabling interaction with background

    //Ignore interaction for background activities
    [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
    

    Now if you want to enable the interaction use following snippet

    if ([[UIApplication sharedApplication] isIgnoringInteractionEvents]) {
    
        // Start interaction with application
        [[UIApplication sharedApplication] endIgnoringInteractionEvents];
    }
    

提交回复
热议问题