I've tried this
NSCharacterSet *myCharSet = [NSCharacterSet characterSetWithCharactersInString: myString];
[myCharSet count];
But get a warning that NSCharacterSet may not respond to count. This is for desktop apps and not iPhone, which I think the above code works with.
...
I'm using an NSTextField to display lines of text that will be printed on a printer with a variable paper size (the printer prints to a spool, which is cut to the appropriate length when the job is done).
I can generate the text no problem, but I need to know how big to make the NSTextField (vertically) so that it exactly contains all o...
Hi,
I have an XML document that may have shift-jis encoded data in it and I'm trying to parse it using an NSXMLParser object.
Ordinarily I assume the document is UTF8 encoded and all is well - does anyone know if/how I can determine if an element is shift-jis encoded and then how to decode it?
Thanks
...
I have set up an operation queue and an invocation operation. Do I need to signal that the invocation is commpleted? If not how will the operation queue knows the invocation is finished and move on to the next one? The operation queue has been set to execute one operation at a time.
...
I have a custom icon file (MyApp.icns) set up for my Cocoa App. How can I access an NSImage representation of the icon from within my application?
Something like the following would be perfect:
NSImage * iconImage = [MyApplication defaultIconAsImage];
But I'm sure it isn't that easy :)
I can, of course, get a path to the icon file a...
I am about to start my A-Level Computing project (High School Level) which will hopefully be a point-of-sale application for Mac OS. Unfortunately, Objective-C is a little out of my league at the moment and should I get stuck with it in the project I have no one to help out so I would fail the section of the course and not get into Univ...
I'm building an application where I want to provide the user with a few dozen templates that will internally take the form of property lists. I would also want to group them in categories, which would conveniently be achieved using folders.
While I have contemplated shipping these files as simple resources in my application, I don't lik...
Thanks Chuck for the quick reply.
I am having a new problem now. my contextual menu is getting displayed but the menu items are not activated.
so my new code for displaying the menu is as follows:
NSMenu *defMenu = [[[NSMenu alloc] initWithTitle:@"default Contextual Menu"] autorelease];
[defMenu insertItemWithTitle:@"Open" action:@sele...
I have an NSTableView with several columns, one of which is set up to use an NSSecureTextFieldCell as its dataCell. I am using a properly configured NSArrayController to provide data to this table.
The problem is that my secure text field does not want to work. It shows an appropriate number of dots for the strings that it holds, but it...
I am working on an app whose main window has an NSDrawer. It is crucial that the drawer will always open on the right edge, and that is how I have coded it to work. What I would like to know is if there is a way to detect if the drawer will open "off the screen"... Is there a way that I can detect this? If so, how? And additionally how c...
I'd like to play a synthesised sound in an iPhone. Instead of using a pre-recorded sound and using SystemSoundID to play an existing binary, I'd like to synthesise it. Partially, that's because I want to be able to play the sound continuously (e.g. when the user's finger is on the screen) instead of a one-off sound sample.
If I wanted t...
Assume I have ten lines of code,
1
2
[addressStreet setStringValue:street]
4
5
6
7
8
9
10
where addressStreet is a IBOutlet pointing to text field in UI and
street is a NSString object.
Only after all the 10 lines are executed I could see the updated value in UI. My requirement is that the value should get reflected in UI immediatel...
I am trying to make my app check the text in a text box and see if it matches any of the strings in an NSArray. I'm hoping you could point me in the right direction or give me some code to do it. I am pretty sure that I would need to use an if statement.
Thanks!
...
Hi.
I'd like to learn how to write application for Mac OS X.
Like how to use XCode properly, Cocoa syntaxes and examples, etc.
I'm already a web developer using ruby, php, mysql, rails, etc.
I looked through google quite some times but never found something palpable to learn from.
But I really want to make my own application, for fu...
I am trying to load an SWF inside a WebView in my cococa app, it works fine when I load an HTML which references the SWF. But i'd like do load the flash file alone, with no HTML. Is that possible??
...
I have been working with NSMutableArray and have had no problems retrieving an object from an array by using objectAtIndex:int. Rather then pulling an object out of the array by an integer is their a way to get the index position by searching the array with a string.
animalOptions = [[NSMutableArray alloc] init];
//Add items
[animalOp...
Like (probably) most people here, I'm not a fan of Software Patents. It makes it hard to write software, especially for an operating system like Mac OS X, where you generally want to do things "the Macintosh way".
But when Apple patents techniques that they use in their own OS and software, it's very difficult for third-party developer...
I have multiple custom NSViews in my Cocoa program. I am looking for a way to force them to invalidate without having to add additional code while the program is running. If I were doing this with on Windows with the .NET framework, I would just drag part of my program offscreen and drag back on again. Areas that was offscreen get in...
How would I play songs or make a splash screen for my cocoa app? I know it's a simple question but I am a complete noob when it comes to cocoa.
...
I am toying with the idea of creating a iPhone UI editor that isn't Interface Builder! Mostly to see if it is possible to do... I have been able to link to the UIKit.framework in a Cocoa app that I have created by dynamically loading it (via NSBundle functionality). I have been able to instantiate an UIView from there. Now the question i...