Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
SBAppContextHostManager: Difference between revisions - iPhone Development Wiki

SBAppContextHostManager: Difference between revisions

From iPhone Development Wiki
No edit summary
mNo edit summary
Line 3: Line 3:


== Context View Requesters ==
== Context View Requesters ==
When an object whats to manipulate an application, such as the multitasking gestures on the iPad sliding applications to one side, they use the applications [[SBAppContextHostView]] rather then manipulating the application itself. However, as {{applink|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.
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 {{applink|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.


{{function signature
{{function signature

Revision as of 20:04, 9 May 2013

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;
Available in 5.0–5.1.1

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.


Signature - (void)orderRequesterFront:(NSString*)requester;
Available in 5.0–

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.


Signature - (SBHostWrapperView*)hostViewForRequester:(NSString*)requester;
Available in 5.0–

This returns the SBHostWrapperView for the specified requester.


Signature - (void)disableHostingForRequester:(NSString*)requester;
Available in 5.0–

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.


Signature - (void)disableHostingForAllRequesters;
Available in 5.0–

This disables context hosting for all enabled requesters.


Screenshots

Signature - (IOSurfaceRef)createIOSurfaceForFrame:(CGRect)frame;
Available in 5.0–
Signature - (IOSurfaceRef)createIOSurfaceForFrame:(CGRect)frame outTransform:(CGAffineTransform)transform;
Available in 5.0–
Signature - (IOSurfaceRef)createIOSurfaceForFrame:(CGRect)frame excludeContext:(unsigned int)contextId outTransform:(CGAffineTransform)transform;
Available in 5.0–
Signature - (IOSurfaceRef)createIOSurfaceForFrame:(CGRect)frame excludeContext:(unsigned int)contextId usePurpleGfx:(BOOL)purpleGfx outTransform:(CGAffineTransform)transform;
Available in 5.0–

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.


Other methods

Signature - (SBAppContextHostView*)_realContextHostViewWhichIReallyNeedToAccessAndIKnowWhatImDoingISwear;
Available in 5.0–

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;
Available in 5.0–

This returns the number of contexts the application has (the number of UIWindows effectively).


References