I'm looking to stream some audio files I have on my server to an iPhone-client application I'm writing. Some of the audio files can be rather large in size, even after compression. My question is, is there a Cocoa framework that helps me with buffering the audio so it becomes available to the user while the rest is being brought down the...
It is possible to write the whole dictionary to a property list object, but I would like to make my application more efficient by only writing out the parts of the property list that have been modified.
Say I have a property list with several dictionaries under the root node. I would like to modify one dictionary and save it, but writin...
I have an NSAttributedString s and an integer i and I'd like a function that takes s and i and returns a new NSAttributedString that has a (stringified) i prepended to s.
It looks like some combination of -stringWithFormat:, -initWithString:, and -insertAttributedString: would do it but I'm having trouble piecing it together without a l...
I don't know why this method returns a blank string:
- (NSString *)installedGitLocation {
NSString *launchPath = @"/usr/bin/which";
// Set up the task
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:launchPath];
NSArray *args = [NSArray arrayWithObject:@"git"];
[task setArguments:args];
// Set the...
Is there a method built in to NSString that tokenizes the string and searches the beginning of each token? the compare method seems to only do the beginning of a string, and using rangeOfString isn't really sufficient because it doesn't have knowledge of tokens. Right now I'm thinking the best way to do this is to call
[myString comp...
Let's say I have a class called SomeClass with a string property name:
@interface SomeClass : NSObject
{
NSString* name;
}
@property (nonatomic, retain) NSString* name;
@end
I understand that name may be assigned a NSMutableString in which case this may lead to errant behavior.
For strings in general, is it always a good idea...
I've got a cocoa app that's got a TableView with bindings to a model through an NSArrayController.
The app works as I want, but the default sort order of the table is wrong.
I typically start the program and click on the last header twice to get it sorting the right way. Is there a way in the nib/bindings/whatever to specify the def...
Is there anyway possible to set the clearButtonMode for a UITextField in Interface Builder? Is this only possible to do code? I do not see it as an option in the UITextField attributes panel.
...
I have one problem to work with NSMutableData.
I defined one NSMutableData *receivedData, and tried to copy several NSData* data to the receivedData. I just called [receivedData appendData:data], but appears the data is not copied:
....
NSLog(@"get data! Received %d bytes of data",[data length]);
// output is not zero, say 1231.
[r...
How do I add a badge to the Dock icon for my app using Cocoa? Is there any roughly "standardized" way to do this?
(I'm referring to the kind of badges that show up in Mail, iChat etc. to indicate the number of unread messages and the like.)
Cocoa Touch does provide one such method, but I haven't been able to find any equivalent for a ...
What's the easiest way to create an array of structs in Cocoa?
...
This question has spawned out of this one. Working with lists of structs in cocoa is not simple. Either use NSArray and encode/decode, or use a C type array and lose the commodities of NSArray. Structs are supposed to be simple, but when a list is needed, one would tend to build a class instead.
When does using lists of structs make sen...
I am writing a cocoa application in which I want to download a file from a webserver. What will be the most convenient method to go about doing this? Should I go in for NSSockets or a NSUrlRequest? Or is there any other easier way to achieve this?
...
I have a NSTableView that contains a NSButtonCell in one of the columns. I can set up the action that is called when the button is clicked in Interface Builder fine, but I can't find anyway to determine which row in the table that the button exists in. Is there any way to do this?
Thanks. :)
...
If I'm looking to use Core Animation to fade a view in and out of display -- is it good practice to have the UIView in the same NIB as the view that it is being drawn into? Should I build the view in another NIB file and load it in from there? I'm looking to animate three small views into display simultaneously upon a user action. I want...
If I have a HUD NSPanel that is black/transparent and I add some controls to it. How do I get the controls to look correct? ie be black/transparent instead of white/opaque?
...
I want to write a cocoa application which downloads a file using ftp. I read about the NSURL class which has "NSURLHandle FTP Property Keys". I want to know how do I make use of these constants to provide username and password to the ftp site.
...
I am writing a cocoa application which has a NSWindow. I want to change the background color of the window to a specific color. But the window properties in the inspector only provide "Textured Window" alternative. How can I make the color of the window as desired?
...
I have subclassed NSPersistentDocument class. I want to add an image to the document. I have an Image Well. How do I set it to a .jpg file?
...
I want to load some data from mysql into my cocoa application view before the application starts.
I am sure that this should happen in the controller so that it can send the required data to the view.
I am looking for a method or common technique that is used for this sort of thing.
Many Thanks
...