Difference between revisions of "SBFolderController"

From iPhone Development Wiki
Jump to: navigation, search
m (Added References section)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
SBFolderController is the superclass of SBRootFolderController you can use this to create a new instance of SBFolderController for any SBFolder (you could also use another SBFolderController, this is relevant with folders in folders). This is useful if you need a SBFolderView.
+
SBFolderController is the superclass of [[SBRootFolderController]]. You can use this class to create a new instance of SBFolderController for any SBFolder (you could also use another SBFolderController, which is relevant for folders within folders). This is useful if you need a SBFolderView.
  
 
== iOS 8 ==
 
== iOS 8 ==
  
 
<source lang=objc>
 
<source lang=objc>
//Create instance of SBFolderController
+
// Get an instance of SBFolderController
SBFolderController *innerFolder = [[[[[%c(SBIconController) sharedInstance] controllerClassForFolder:[iconView.icon folder]] alloc] initWithFolder:[iconView.icon folder] orientation:[[%c(SBIconController) sharedInstance] orientation] viewMap:[[[%c(SBIconController) sharedInstance] _rootFolderController] _viewMap]] autorelease];
+
SBIconController *iconController = [%c(SBIconController) sharedInstance];
 +
SBRootFolderController *rootFolderController = [iconController _rootFolderController];
 +
SBFolder *folder = [iconView.icon folder];
 +
Class controllerClass = [iconController controllerClassForFolder:folder];
 +
 
 +
SBFolderController *innerFolder = [[[controllerClass alloc] initWithFolder:folder orientation:[iconController orientation] viewMap:[rootFolderController _viewMap]] autorelease];
 
//Tell rootFolderController we have an innerFolderController
 
//Tell rootFolderController we have an innerFolderController
[[[%c(SBIconController) sharedInstance] _rootFolderController] setInnerFolderController:innerFolder];
+
[rootFolderController setInnerFolderController:innerFolder];
 
 
  
 
//Folder view retrieved with:
 
//Folder view retrieved with:
 
SBFolderView *view = [innerFolder contentView];
 
SBFolderView *view = [innerFolder contentView];
 
  
 
//To close folder
 
//To close folder
[[[%c(SBIconController) sharedInstance] _rootFolderController] _setInnerFolderOpen:NO animated:NO completion:nil];
+
[rootFolderController _setInnerFolderOpen:NO animated:NO completion:nil];
 
</source>
 
</source>
 +
 +
== References ==
 +
 +
<references/>
 +
 +
{{occlass|library=SpringBoard.app|navbox=1}}

Latest revision as of 14:13, 11 August 2015

SBFolderController is the superclass of SBRootFolderController. You can use this class to create a new instance of SBFolderController for any SBFolder (you could also use another SBFolderController, which is relevant for folders within folders). This is useful if you need a SBFolderView.

iOS 8

// Get an instance of SBFolderController
SBIconController *iconController = [%c(SBIconController) sharedInstance];
SBRootFolderController *rootFolderController = [iconController _rootFolderController];
SBFolder *folder = [iconView.icon folder];
Class controllerClass = [iconController controllerClassForFolder:folder];

SBFolderController *innerFolder = [[[controllerClass alloc] initWithFolder:folder orientation:[iconController orientation] viewMap:[rootFolderController _viewMap]] autorelease];
//Tell rootFolderController we have an innerFolderController
[rootFolderController setInnerFolderController:innerFolder];

//Folder view retrieved with:
SBFolderView *view = [innerFolder contentView];

//To close folder
[rootFolderController _setInnerFolderOpen:NO animated:NO completion:nil];

References