Hi,
I'm trying to get a UITableView to read it's data from a file. I've attempted it like this:
NSArray *paths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullFileName = [NSString stringWithFormat:@"%@/entries.plist", documentsDir...
I have the command language part sorted out, I'm looking for good sample on how to build a custom console in Cocoa. Need features like copy/paste, command stack, ctrl-z processsing etc. Thanks in advance.
...
I have an NSTableView that has 2 columns, one for an icon and the other for two lines of text. In the second column, the text column, I have some larger text that is for the name of an item. Then I have a new line and some smaller text that describes the state of the item.
When the name becomes so large that it doesn't fit on one line i...
I need to determine whether a string (sourceString) contains another string (queryString) and if it does, at what offset.
I'm guessing that NSScanner might do the trick but I don't fully understand the documentation.
Let's say sourceString = @"What's the weather in London today?"
If I set queryString to equal @"What's the weather", I...
Hey guys, I am trying do write an application(server) which receives the keyboard instructions from the client and execute them on the server end. It's more like those screen recorders which records your keyboard and mouse events and replay them. For example, you pull up a textedit on the server, type whatever you like on the client and ...
I have a dynamic array of strings, the elements of which I would like to localize. Is there a way to localize the strings without iteration e.g. something like using "makeObjectsPerformSelector". Thank you
...
Just doing some research on searching for a character or word within a NSString and I came across this code snippet (which works like a charm):
return [sourceString rangeOfString:searchString].location != NSNotFound;
Am I right in thinking that the above code is functionally identical to:
NSRange range = [sourceString rangeOfString:s...
I have a class (MyClass) with a lot of methods. Consequently, the .m file has become quite difficult to read. I'm relatively new to Objective-C (having come from REALbasic) and I was wondering if it's possible to put some of the methods in MyClass into different files and then include them in the class. How would I go about this in Xcode...
Hi, I am working on application which required me to change the filename case retaining the original filename as it is For Example: need to change abc.txt => (ABC.txt or Abc.txt or abc.TXT or abc.Txt) filename as well as its extension can be change in same way. I tried to use the NSFileManager
- (BOOL)movePath:(NSString *)source toPath...
Cocoa is full of singletons. Is there a logical/conventional difference between when the Cocoa APIs use
NSSingletonObject *so = [NSSingletonObject defaultSingleton];
versus
NSSingletonObject *so = [NSSingletonObject sharedSingleton];
?
Not a huge thing, but I don't really see why sometimes one is used versus the other.
...
Hi,
So I'm getting a EXC_BAD_ACCESS error in cocos2d. From what I've been searching so far it's mostly related to attempting to free an object which has already been released. I have encountered this error before, and its solution was simple and pretty much caused by freeing a released object. But now, using cocos2d (not sure if it's a ...
Whenever a user would type a number, my app would automatically prepend a currency sign before that number. For example, when the user types "1" in a text field, the text inside it becomes "$1.00". All is good when I use an NSNumberFormatter, an NSTextField, and its delegate method control:didFailToFormatString:errorDescription:.
- (BOO...
I've been working through the exercises in a book recommended here on stackoverflow, however I've run into a problem and after three days of banging my head on the wall, I think I need some help.
I'm working through the "Speakline" exercise where we add a TableView to the interface and the table will display the "voices" that you can ch...
Why would the default iPhone interface elements, specifically the UISwitch (unmodified) and a UISegmentedControl appear slightly blurred? I have not changed them or called any private APIs. This blurring occurs when I run it both in the simulator and when I load it on my iPod Touch, so I don't think it's a one off drawing glitch. These e...
Is it possible to focus a NSWindow by its CGWindowID? And yes, how?
I need to focus a Window of another application, but I have only its CGWindowID and I can only find sample code about retrieving the ID, but not how to focus a Window by its ID.
...
I put "return" in quotes because I don't want to literally return it. I want to do it similar to how you pass a pointer-to-a-pointer for [NSString stringWithContentsOfFile:usedEncoding:error:].
I would like to make parseFiles:error return nil and have the error reference that was passed in contain the first or second error, depending on...
How can I have the text scale to fit the bounds I gave it?
...
Hi, i wrote the following code :
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSDictionary *reportDic = [jsonparser objectWithString:json_string error:nil];
NSDictionary *reporttable = ...
So, the application I'm trying to script has a scripting definition file that includes a <contents> element, which is an "implicitly specified container."
The question, how do I get at what's inside this element using Scripting Bridge? Or alternatively, how do I send the Apple Event necessary to retrieve it and then transform what I ge...
Hi,
Here's what I am trying to do. I need to prompt the user for a password prompt and until he enters the password and hits, say the Enter button on the sheet, I want to prevent the code being parsed in the background.
Here's the code to run the sheet and when the user enters the password and hits Enter, endSpeedSheet is run. I am call...