I have the following code, which works as I expect. What I would like to know if there is an accepted Cocoa way of splitting a string into an array with each character of the string as an object in an array?
- (NSString *)doStuffWithString:(NSString *)string {
NSMutableArray *stringBuffer = [NSMutableArray arrayWithCapacity:[string...
I have a set of NSTimeIntervals like this:
NSArray *mySet = [NSArray arrayWithObjects:
[NSNumber numberWithDouble: time1], //
[NSNumber numberWithDouble: time2],
[NSNumber numberWithDouble: time3],
nil];
// suppose that at this time
// time1 = 0.00000
// time2 = 18.3200
// time3 = 21.6500
at some point in my code I want to ...
I am trying to load nib at run time. I am using Button control & binding it to one method & outlet.
But problem is that when i load it run time it not display button.
Also When i click on position where i placed button in interface builder, it executes binded method. I don't understand what is happening ?
...
Hi
Is there a way to provide a method implementation (that bears the exact same name of a method defined by the framework) only when the method isn't already defined in the system? For example method [NSSomeClass someMethod:] exists only in Mac OS X 10.6 and if my app runs in 10.5, I will provide that method's definition in a category....
I have a double number and I would like to convert it to string.
The number is, for example, something like
24.043333332154465777...
but if I convert it to string using something like
NSString *myString = [NSString stringWithFormat:@"%f", myDouble];
The string is just
24.043333
how do I get a full string the corresponds to the wh...
Hello all,
im looking to read the contents of a webpage that is secured with a user name and password. this is a mac OS X application NOT an iphone app so most of the things i have read on here or been suggested to read do not seem to work.
Also i am a total beginner with Xcode and Obj C i was told to have a look at a website that provi...
I know my way around Objective-C and I have experience with garbage collection from .NET, although I never used it in objective-c. I write my code without using it.
Now I'm thinkig about using one of the frameworks (Blocks) which is available as GC-only. My question is - can I still use the framework without any changes to my current no...
I'm trying to print a document. The document is an array of NSImageReps, or a single NSPDFImageRep, which has multiple pages. I'm having trouble figuring out how to use the NSPrintOperation class to print this.
The NSPrintOperation seems to need an NSView to print. Do I need to manually add each image into the view at a calculated pos...
Hello,
I am writing a class that opens an AudioQueue and analyzes its characteristics, and then under certain conditions can begin or end writing out a file from that AudioQueue that is already instantiated. This is my code (entirely based on SpeakHere) that opens the AudioQueue without writing anything out to tmp:
void AQRecorder::St...
I am having trouble getting my modal view controllers to display properly. I have a parent view controller that is the delegate for modal view A. In modal view A I am presenting modal view B, and having the delegate dimiss modal view A.
When modal view B appears it seems to display but the screen dims, and the UI locks up, but the app d...
I have a fairly large hierarchical dataset I'm importing. The total size of the database after import is about 270MB in sqlite. My current method works, but I know I'm hogging memory as I do it. For instance, if I run with Zombies, my system freezes up (although it will execute just fine if I don't use that Instrument). I was hoping for ...
Update
I wrote a minimal code example of the issue I am having. I implemented the background work two ways: manually spawning threads and letting NSOperation handle threading. In both cases I am creating NSManagedObjectContexts for each thread/operation.
When I spawn the threads myself with performSelectorInBackground:withObject: eve...
In a portion of a program I'm working on, I need to count all the times each person has worked on projects with each other person. Let's say we have "Employee" entities and "Session" entities. In each session, there are four project types, "A", "B", "C", & "D", each a many-to-many relationship to Employees.
I'm making a loop to system...
In my Cocoa Mac app I have an instance A which contains an unordered set of instances B which in turn has an ordered set of instances C. An instance of C can only be in one instance B and B only in one A.
I would like to have an unordered set of all instances C available on instance A. I could enumerate over all instances B each time,...
Some mac apps, like iTunes and Spotify, react to the play/pause/next/previous buttons on some Apple keyboards.
Presumably they're tapping into some sort of NSNotification, how can I do the same?
...
Hi,
the iPhone SDK provides with MapKit a simple solution for maps und reverse geocoding without any additional costs. Does anyone know if there is a similar Framework for Cocoa on OSX? I know that google maps is capable of that but as far as I know and understand I have to pay while using google maps in a commercial application?
Thank...
Why do parameters lists in some methods end with nil? I have noticed this particularly in the collection classes for example NSSet
mySet = [NSSet setWithObjects:someData, aValue, aString, nil];
and NSArray
NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil];
...
Hi,
I'm using the following method in my code:
- (NSMutableArray *) newOrderedArray:(NSMutableArray *)array ByKey:(NSString *)key ascending:(BOOL)ascending {
NSSortDescriptor *idDescriptor = [[NSSortDescriptor alloc] initWithKey:key ascending:ascending];
NSArray *sortDescriptors = [NSArray arrayWithObject:idDescriptor];
N...
Here is a simple code that shows what I think is a bug when dealing with double numbers...
double wtf = 36.76662445068359375000;
id xxx = [NSDecimalNumber numberWithDouble: wtf];
NSString *myBug = [xxx stringValue];
NSLog(@"%.20f", wtf);
NSLog(@"%@", myBug);
NSLog(@"-------\n");
the terminal will show two different numbers
36.7666244...
i am new to the world of cocoa programming, i want to add applescript support to my app.
Also the example at apple's website seems out of date
...