cocoa

Class method equivalent of -respondsToSelector:

Is there a class method equivalent to -respondsToSelector:? Something like +respondsToSelector:? The reason I am asking is because by implementing -respondsToSelector: on a class level, I get a compiler warning: "found '-respondsToSelector:' instead of '+respondsToSelector:' in protocol(s)". The code looks like this: Class <SomeProto...

Is it possible to copy a different plist into the application bundle code wise??

Hello all again. My question is stated above in the title but I'll write it here again Is it possible to copy a different plist into the application bundle code wise?? This is actually a bit related on my previous question ;) http://stackoverflow.com/questions/1125048/create-a-dictionary-property-list-programmatically But since I ca...

How can I send a HTML email from Cocoa?

I'm looking for a way to create a HTML formatted email from a OS X Cocoa application. My preferred workflow would be: The user selects a menu item and the default mail application opens with a pre-filled new email in the foreground. I'm able to do this with mailto and -[NSWorkspace openURL] for plain text emails, but this doesn't work ...

cocoa - comparing dates, warning passing argument one of 'compare:' from distinctive objective-c type.

Hi, I've had a look through similar queries on here and elsewhere but i still can't seem to resolve my problem. I am trying to see whether a date stored in a mutable dictionary in an array is between two other dates. The piece of code generating the warning is: if ( [[[records objectAtIndex:( i )] objectForKey:@"Date"] compare:userSta...

Address Book thread safety and performance

My sense from the Address Book documentation and my understanding of the underlying CoreData implementation suggests that Address Book should be thread safe, and making queries from multiple threads should pose no problems. But I'm having trouble finding any explicit discussion of thread safety in the docs. This raises a few questions: ...

comparing arrays in objective-c

Ok a pretty simple question.. in c++ it seems to work but in objective-c i seem to struggle with it :S .. If you want to compare two arrays it should be something like this right for ( int i = 0; i < [appdelegate.nicearray count]; i++ ) { if ( appdelegate.nicearray[i] == appdelegate.exercarray[i] ) { NSLog(@"the same elem...

How to extract ID tags from MP3 files in Cocoa?

Please advise some way to extract MP3 attributes using simple API. Is there any other libraries other than ID3.framework? I found that it is quite out-dated and has memory leaks. Thanks a lot. ...

Mixing Carbon and Cocoa and then what about other platforms?

I have a static library that shares a lot of source between the OS X and Windows versions. Both versions use CMAKE. I have thought about a linux version due to recent requests. OS X and uses Carbon. Windows uses straign win32 API, no MFC is in C++ (.cpp) My questions are: For the OS X version Apple is throwing away 64-bit Carbon, s...

Convert first number in an NSString into an Integer?

I have an NSString like so: @"200hello" or @"0 something" What I would like to be able to do is take the first occuring number in the NSString and convert it into an int. So that @"200hello" would become int = 200. and @"0 something" would become int = 0. ...

Obtain a CGContextRef of NSView outside of drawRect ?

I need to get CGContextRef of NSView object. It won't be so bad if I knew how. In Carbon this thing was done like this: CGContextRef cgref = (libvlc_drawable_t)GetWindowPort(HIViewGetWindow((OpaqueControlRef*)hiViewRef)); Obviously it can be done by subclassing NSView (or it's subclass) and catching it in it's drawRect, but that's to...

How to read/write ints from/to NSStreams

How can I read and write ints from/to NSStreams? I know I can read bytes individually, but I want to take endianness into account. Java has DataStreams for these cases, is there something equivalent in Obj-C? ...

Is the file hidden?

How can I determine whether a certain path points to a hidden file/folder? NSString *file = @"/my/file/some.where"; BOOL fileIsHidden = // <-- what do I do here? I know that hidden files are prefixed by a period. This is not the only criteria for a file to be hidden. I've read somewhere that there's a .hidden file that also configures...

What is tiny_free_list_add_ptr?

I've searched far and wide for its meaning. My guess is that I somehow have a corrupt stack. I get tiny _ free_ list_ add_ ptr on the 16th call of the line that says: NSDateFormatter *theFormatter = [[NSDateFormatter alloc] init]; What is the cause of the problem? Am I correct in thinking that I have a corrupt stack? - (NSStr...

Is it wise to "nest" UIViewControllers inside other UIViewControllers like you would UIViews?

I've got a fairly complex view, for me anyway, that has a few "trays" with custom interface items on them. They slide in and out of my root view. I'd like to nest (addSubview) the items inside the view. Each needs some setup before being displayed...and none can be configured in IB (they're subclasses of UIView). I'm wondering if it ma...

UIView and NSTimer not releasing memory.

I have a line of UILabel text in a UIView which is regularly updated via NSTimer. This code is supposed to write a status item near the bottom of the screen every so often. The data comes from outside of its control. My app runs out of memory really fast because it seems the UILabel is not being released. It seems that dealloc is never ...

Cocoa - Notification on NSUserDefaults value change?

Let's say I have a key @"MyPreference", with a corresponding value stored through NSUserDefaults. Is there a way to be Notified when the value is modified? Or could it be done through bindings? (But this case, instead of binding the value to a UI element, I wish my object to be notified of the change, so that I can perform other tasks....

Does the iphone have a built in dictionary that other apps can access?

Hi all, In one of my application i need to check that spelling of word is correct or not. so I what's to know, Does the iphone have a built in dictionary that other apps can access? if yes, then how to do that. please help me. ...

How can I animate the movement of a view or image along a curved path?

Hi all, I am developing a commerce application. When I add an item to the cart, I want to create an effect where an image of the item follows a curve path and ends up at the cart tab. This can be seen in Barnes and Nobles Bookstore app in the App store. ...

KeyDown and Cocoa Sample

I'm learning how to build program with Cocoa. I'm using a sample Apple application that record video from WebCam. I'd like to start ant stop video capture by key press. I've tried to override Keydown event but I've read that It's not possible in an NSObject. How can I handle this kind of event? The class of application extends a NSObjec...

Memory leak in removeItemAtPath:error:?

I'm running an app on the iPhone that performs the following action: + (void)performWrite:(NSData *)data { [data retain]; [data writeToFile:@"WriteTest.tst" atomically:YES]; [[NSFileManager defaultManager] removeItemAtPath:@"WriteTest.tst" error:NULL]; [data release]; } When running in Instruments, however, I see a lea...