HI all
I have problem with
NSString *filePaht = [[NSBundle mainBundle] pathForResource:(NSString *)name ofType:(NSString *)ext];
if I used
NSString *filePaht = [[NSBundle mainBundle] pathForResource:@"soundName" ofType:@"aiff"];
it's OK
but when I used
NSString *fileName = [[file.list objectAtIndex:index] objectForKey:@"soundName"];
N...
I am currently writing a plug-in framework for my application. I would like to be able to release plugins without having to update my application, and I intend on making the framework available for third party plugins. I am currently running into issues when two plugins ship with identical frameworks. When the plugins are loaded the runt...
Here's a picture of one of the stranger problems I've had. I'm using a plugin architecture to draw things in Core Graphics. The host app creates a context that is passed to the plugin, which draws into the context and sends it back. Here this was done multiple times to draw multiple objects (though just for demonstration, it happens even...
I am currently working directly with Cocoa for the first time to built a screen saver. Now I came across a problem when trying to load resources from within the .saver bundle. I basically have a small C++ wrapper class to load .exr files using freeImage. This works as long as I use absoulte paths, but that's not very useful, is it? So, b...
Using NSBundle in "Iphone" and "Xcode":
I have three folders on Mac, with the same file name: AnyFile.txt the structure is the following:
Folder1
|- AnyFile.txt
Folder2
|- AnyFile.txt
|-- Folder3
|- AnyFile.txt
I put them into Xcode as REFERENCE in three different GROUPS (with the same structure as the above)
I want to read ...
Hey all,
I'm looking into a project that would upload custom NSBundles that include a NSViewController. In my main program I've got this code to deal with the bundle after it's been loaded...
id principalClass = [loadedBundle principalClass];
id instance = [[principalClass alloc] init];
[localLabel setStringValue:[instance name]];
NSVi...
Hi
It seems that Objective C jumps thru hoops to make seemingly simple tasks extremely difficult.
I simply need to create a sequence of strings, image1.jpg, image2.jpg, etc etc
ie in a loop
var imgString:String='image'+i+'.jpg;
I assume a best practice is to use a NSMutableString with appendString method?
What am I doing wrong??
NSM...
I created OCUnit test in concordance with "iPhone Development Guide". Here is the class I want to test:
// myClass.h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface myClass : NSObject {
UIImage *image;
}
@property (readonly) UIImage *image;
- (id)initWithIndex:(NSUInteger)aIndex;
@end
// myClass.m
#import "my...
Currently I am working on iPad. In the Resources folder of project, I have a sub-directory "sounds". How can I access it to get the contents of this sub-directory?
I have tried:
NSArray *array = [fileManager directoryContentsAtPath:
[[[NSBundle mainBundle] bundlePath]
stringByAppendingString:@"soun...
I want to use pathForResource, but it doesn't look like it will create the path if one doesn't exist. Therefore I'm trying to create one manually by doing the following:
NSString *path = [NSString stringWithFormat:@"%@/%@.plist",[[NSBundle mainBundle] bundlePath],@"myFileName"];
I'm creating files dynamically, so I need to access th...
Using the Settings app in the iPhone simulator to switch languages is a PITA way of testing localization tweaks. I'm trying to figure out a way to switch localizations (en/fr/es/etc) on the fly in my app with a debug setting without restarting the app.
NSBundle provides ways of requesting localized resources from an arbitrary localizati...
I have tried to read the main application via several methodes but i got nothing back
Using NSFileHandle it returns nothing with the folowing code :
NSFilemanager *filemanager = [ filemanager defaultmanager ] ;
NSString *myfile = [ [ NSBundle mainBundle ] bundlePath ] ;
if ( [ filemanager isReadableFileAtPath:myfile ] )
NS...
Hello,
I am using the following code in my Cocoa project to call a script I made. The script is in the same folder as the project and even shows up under the "Resources" folder in XCode. The proper path is found, but it still says that the path is not accessible. Help please.
NSBundle *mainBundle=[NSBundle mainBundle];
NSString *path=[...
Hello,
I am trying to load a bundle using bundleWithPath but it always fails (returns nil)
I was wondering what can be teh reasons why it fails and what are the way to het more information about the error.
Thanks in advance for your help!
Regards,
...
I'm probably not doing this correctly. Having not done an iPad app before I'm doing what seems natural to me.
I have a UIView that is going to be made of up other UIViews. Specifically, I want to dynamically create and add subviews to each of these subviews. In other words:
UIView
|
| --> UIView
|
| --> Dyna...
Hi,
I am trying to copy a couple of image files from my MainBundle/SampleImages folder to the application NSDocumentDirectory/Library folder, but am unable to do so. I have checked that the images are in .app/Mainbundle/SampleImages directory and I have also checked that the Library folder is being created in the NSDocumentsDirectory, ...
Hi,
i want to change the locale programmatically in my iphone app (basically because not all languages are supported by iphone itself, it should be possible for the user to switch language only for my application). I have seen on a different question http://stackoverflow.com/questions/1669645/how-to-force-nslocalizedstring-to-use-a-speci...
This is a problem which has been bugging me for a while now. I'm still pretty new with some of these patterns so you'll have to forgive me (and correct me) if I use any of the terms incorrectly.
My Methodology
I've created a game engine. All of the objects in my game engine use inversion of control to get dependencies. These depend...
I dont know the exact code i need to retrieve all of the filenames of the resources in my iphone apps mainBundle. if i could have some kind of code like:
NSArray *array = [[NSBundle mainBundle] getAllResourceFilenames];
it would be helpful. thanks inadvanced for any help!
...
I have an image in my iPhone Project. It's a PNG and I can set the background in Interface Builder but I want to do this programatically.
NSLog(@"Before %@", myEasterEgg);
uiImageBackground.backgroundColor = [UIColor purpleColor];
myEasterEgg = [myEasterEgg stringByAppendingString:@"5"];
NSLog(@"After %@", myEasterEgg);
if (CFStringComp...