The SBAppContextHostManager class was introduced in iOS 5 when SpringBoard's means for handling the SBAppContextHostView class was redesigned. The methods which track an applications SBContexts and keep it updated with any changes were moved from SBAppContextHostView to SBAppContextHostManager. Most of SBAppContextHostManagers other methods control access to the single SBAppContextHostView each application has.
Context View Requesters
When an object wants to manipulate an application, such as the multitasking gestures on the iPad sliding applications to one side, they use the application's SBAppContextHostView rather than manipulating the application itself. However, as SpringBoard expanded how many classes use this single view the chance 2 could be using it at once increased. In iOS 5 apple introduced the SBAppContextHostManager to manage all the different groups that want to access it.
|Signature||- (void)enableHostingForRequester:(NSString*)requester orderFront:(BOOL)orderFront;|
The requester is an NSString which is used to identify the request. Everything which wants to access the context view should use a unique id. This will add the requester to it's iVar "NSMutableArray *_hostRequesters;" which tells it to create an SBHostWrapperView. orderFront indicates whether or not the SBAppContextHostView should be added as a subview or not (and so become the active requester).
|Signature||- (void)enableHostingForRequester:(NSString*)requester priority:(int)priority;|
|Available in||6.0 -|
This method is the iOS 6 replacement for the above method. Rather then stating that the requester wants to be the activate requester now, it instead passes a priority (probably indicating how import it is it is the active requester). The range of values used for the priority variable are unknown.
This is the method that moves the SBAppContextHostView into the SBHostWrapperView associated with that requester. If the requester was not enabled then it is does nothing.
This returns the SBHostWrapperView for the specified requester.
This disables context hosting for the specified requester. The SBAppContextHostView is removed from the SBHostWrapperView for the requester, if it was active and removes the requester from the list of allowed requesters.
This disables context hosting for all enabled requesters.
|Signature||- (IOSurfaceRef)createIOSurfaceForFrame:(CGRect)frame outTransform:(CGAffineTransform)transform;|
|Signature||- (IOSurfaceRef)createIOSurfaceForFrame:(CGRect)frame excludeContext:(unsigned int)contextId outTransform:(CGAffineTransform)transform;|
|Signature||- (IOSurfaceRef)createIOSurfaceForFrame:(CGRect)frame excludeContext:(unsigned int)contextId usePurpleGfx:(BOOL)purpleGfx outTransform:(CGAffineTransform)transform;|
These methods return a screenshot of the application, and only the application. As they only take a screenshot of the application, and not the screen, they should be the preferred method of getting app screenshots in iOS. Whereas functions such as UICreateScreenImage() include everything on screen, including the multitasking switcher or the notification center, these methods allow a screenshot of a currently running application. They allow you to specify a frame you want the image to be of, to exclude certain windows (such as say the status bar or an alert), and to apply other settings to the image.
This method returns not an SBHostWrapperView but the actual underlying SBAppContextHostView itself. The method name is meant to deter you from using it, and indeed you should not use this method. Even if you know what you are doing using the other methods is safer.
|Signature||@property(readonly, nonatomic) unsigned int contextCount;|
This returns the number of contexts the application has (the number of UIWindows effectively).
- iOS5 header: https://github.com/MarcoSero/SpringBoard-iOS-5.0/blob/master/SBAppContextHostManager.h
- iOS6 header: https://github.com/caughtinflux/iOS-6-SpringBoard-Headers/blob/master/SBAppContextHostManager.h