IconSupport: Difference between revisions

From iPhone Development Wiki
(New How to use this library format.)
No edit summary
Line 1: Line 1:
{{Infobox Package
The NSAutoreleasePool class is a thin wrapper around the '''NSPushAutoreleasePool''' and '''NSPopAutoreleasePool''' functions.
|developer=Sakurina, chpwn, ashikase
|version=1.8.1-1
|package=com.chpwn.iconsupport
}}
'''IconSupport''' is a library that helps icon-layout-modifying tweaks play nicely together.
 
Quoted from its depiction:
 
<blockquote>
<p>IconSupport is a package for use by extensions that modify how SpringBoard lays-out icons (such as extensions that change the number of icons shown per row/column).</p>
<p>Normally, syncing with iTunes or booting into Mobile Substrate's Safe Mode would cause these modified layouts to be reset; IconSupport prevents this.</p>
<p>IconSupport also handles repairing layouts when installing and uninstalling IconSupport-enabled extensions.</p>
</blockquote>
 
Quoted from the README of its [https://github.com/Xuzz/IconSupport source on GitHub]:
 
<blockquote>
<p>Uses a unique ID for each combination of packages, so icon state is never lost via respring or uninstalling a new package.</p>
</blockquote>
 
== How to use this library ==
 
Headers are available from [https://github.com/Xuzz/IconSupport/blob/master/Extension/ISIconSupport.h IconSupport's GitHub project]. If using Theos, place the headers in <code>$THEOS/include/IconSupport</code>.
 
=== Include directive ===


<source lang="objc">
<source lang="objc">
#import <IconSupport/ISIconSupport.h>
#ifdef __cplusplus
extern "C" {
#endif
void *NSPushAutoreleasePool(NSUInteger capacity);
void NSPopAutoreleasePool(void* token);
#ifdef __cplusplus
}
#endif
</source>
</source>


=== Packaging ===
Example:


Add to your package's control file:
<source lang="objc">
 
static void MyMethod()
* <code>, com.chpwn.iconsupport</code> to the <code>Depends</code> field.
{
 
    void *pool = NSPushAutoreleasePool(0);
== Usage ==
    [[[NSObject alloc] init] autorelease];
 
    NSPopAutoreleasePool(pool);
<source lang="logos">
%ctor {
dlopen("/Library/MobileSubstrate/DynamicLibraries/IconSupport.dylib", RTLD_NOW);
[[%c("ISIconSupport") sharedInstance] addExtension:@"theNameOfMyExtension"];
}
}
</source>
</source>


== External links ==
The "capacity" argument of NSPushAutoreleasePool only serves as a hint. It is unused in the current implementation.
 
* [https://github.com/Xuzz/IconSupport source on GitHub].
 
{{Navbox Library}}
 
[[Category:Cydia packages]]


[[Category:Directories in /Library]]
{{occlass|library=Foundation.framework}}

Revision as of 09:43, 2 February 2017

The NSAutoreleasePool class is a thin wrapper around the NSPushAutoreleasePool and NSPopAutoreleasePool functions.

#ifdef __cplusplus
extern "C" {
#endif
void *NSPushAutoreleasePool(NSUInteger capacity);
void NSPopAutoreleasePool(void* token);
#ifdef __cplusplus
}
#endif

Example:

static void MyMethod()
{
    void *pool = NSPushAutoreleasePool(0);
    [[[NSObject alloc] init] autorelease];
    NSPopAutoreleasePool(pool);
}

The "capacity" argument of NSPushAutoreleasePool only serves as a hint. It is unused in the current implementation.