Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>That is not the way you include resources using theos. MyTweak_FILES variable should only include files that can be compiled. Make file handles resources differently.</p> <p>To include resources you need to create a bundle as follows.</p> <p><strong>1) Create a folder called Resources in the tweak.xm directory.</strong></p> <p><strong>2) Put all your resource files (all your PNG's) into that folder.</strong></p> <p><strong>3) Add the following info to your make file</strong></p> <pre><code>BUNDLE_NAME = your_bundle_identifier your_bundle_identifier_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries include $(THEOS)/makefiles/bundle.mk </code></pre> <p><strong>4) Define your bundle as follows on top of your tweak.xm file.</strong> </p> <pre><code>#define kBundlePath @"/Library/MobileSubstrate/DynamicLibraries/your_bundle_identifier.bundle" </code></pre> <p><strong>5) You can now initialize the bundle and use the images within your tweak as follows:</strong></p> <pre><code>NSBundle *bundle = [[[NSBundle alloc] initWithPath:kBundlePath] autorelease]; NSString *imagePath = [bundle pathForResource:@"your_image_name" ofType:@"png"]; UIImage *myImage = [UIImage imageWithContentsOfFile:imagePath] </code></pre> <p>In the above steps replace your_bundle_identifier with your tweaks bundle identifier which would be in the control file. (ex: com.yourdomain.tweak_name)</p> <p>Also replace your_image_name with the name of the image you want to use.</p> <p>You can pretty much use any resources (ex: sound files) the above way.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload