pthread vs NSThread: which is faster
In Cocoa, is NSThread faster than pthread? is are any performance gain? is it negligible to ignore? ...
In Cocoa, is NSThread faster than pthread? is are any performance gain? is it negligible to ignore? ...
Hi. I have trouble with deleting all layer's sublayers. I do this manually, but it's unwanted code clutter. I found many topics about this in google, but no answer. I tried to do something like this: for(CALayer *layer in rootLayer.sublayers) { [layer removeFromSublayer]; } but it didn't work. Also, i tried to clone rootLayer....
Hi all, I've a MainMenu.xib and a MyDocument.xib. I need to dynamically populate some NSMenuItem's from my document controller but I'm at a loss on how to get to it from MainMenu.xib. I've tried adding an NSObject to MainMenu.xib and make it an instance of my document controller but I can't populate the NSMenuItem's from the NSArrayCon...
I have a set of data where one of the attributes (Firmware) is a one-to-many relationship. If I want to get any records where the firmware id is 1 I can create a predicate using @"(ANY Firmware.FID==1)" Then I have another set of conditions that will refine the set even more using (TopLevel==YES) AND (Parent>0) How can I combine t...
I have a NSArrayController and I when I get the selectedObjects and create a NSString with the value of valueForKey:@"Name" it returns ( "This is still a work in progress " ) and all I want to have is the text in the "" how would I get that? also, this my code: NSArray *arrayWithSelectedObjects = [[NSArray alloc] initWithArray:[...
Why does cocoa use delegates rather than inheritance? ...
I have a NSTableView which gets it's data from a NSArrayController and I need to delete the currently selected row, I know NSManagedObjectContext has a delete deleteObject: method but I can't think of how to deleted it from the NSArrayController? ...
I have a pretty standard setup where I have an array in my controller that I'm binding to an NSTableView. When I add an object to this array with the UI, I add elements by copying the array to a mutable array, adding the contents, then copying it back. I saw this idiom somewhere, but I'm not really sure where, or whether this is actually...
What do I need to do to update a tableView bound to an NSArrayController when a method is called that updates the underlying array? An example might clarify this. When my application launches, it creates a SubwayTrain. When SubwayTrain is initialised, it creates a single SubwayCar. SubwayCar has a mutable array 'passengers'. When a ...
Hi, I have 3 tracks in iTunes and run this procedure: -(IBAction)reloadButtonClick:(id)sender; { NSAppleScript *script ; NSString *source ; NSString *result; NSDictionary *errorDic ; NSAppleEventDescriptor *ed; int total; source= @"tell application \"iTunes\" to get cou...
I have a core data entity named "Folder". Each "Folder" has a 1-to-many relationship with the entity "File", and each file contains the field "filename". What is a succinct way of producing an array of all of the filenames for a given folder? I expected it to be something like: NSManagedObject* folder = [self getSomeFolder]; NSArray*...
An NSControl's cell isn't in the view hierarchy. Am I correct? If it isn't, how is it being drawn on the view if it's not in the view hierarchy? I ask because I want to have a View/Control subclass that I can drag out onto a contentview, then add buttons into that view, and have the lowest component be the cell. So the cell can get all...
Hey guys! I think I understand how Objective-C++ works in relation to Cocoa, and I am fairly versed in the basics of command-line C++ but sort of afraid to try mixing it with Objective-C. I can create a GUI with Interface Builder in Xcode, and even make classes (.h and .m files) for the interface automatically. The outlets, maybe action...
i am trying to get drag and drop working in xcode 3.1.4 on osx/leopard. any pointers or hints or maybe even example code? i cannot find anything out there and it is really disappointing. i want to have the interface respond if files are dragged on the main window. ...
I have an NSOutlineView bound to a NSTreeController and a CoreData Datamodel. NSOutlineView displays his data properly. A NSTableView's cell values bound to a NSArrayController, displaying data from CoreData. NSTableview displays his data properly too. The Datamodel has a relationship between data for NSOutlineView and NSTableView W...
Before you ask, yes, I have a very good reason for wanting something to run on 10.3. It's a very small in-house project that must run on a very important person's machine, which cannot be upgraded for a very good reason. =) The 10.6 DVD doesn't seem to offer an option to install the 10.3 SDK, only 10.4+. I also can't seem to find it on ...
Hi. I am new to iphone development. I am "old School" - I was tought to use Procedures etc. when programming. Everything is object oriented these days but my style is still as its always been. Please bear that in mind. My project is tiny and really just a proof of concept. The program below works on a timer - every 30 seconds it will r...
Hello, I am working on my first OpenGL application using Cocoa (I have used OpenGL ES on the iPhone) and I am having trouble loading a texture from an image file. Here is my texture loading code: @interface MyOpenGLView : NSOpenGLView { GLenum texFormat[ 1 ]; // Format of texture (GL_RGB, GL_RGBA) NSSize texSize[ 1 ]; // Width a...
Which variant is more correctly? //first variant - (NSArray*) someArray { NSMutableArray* mutArr = [[NSMutableArray alloc] init]; //...some operations with mutArr NSArray* retArray = [mutArr copy]; [mutArr release]; //remove mutArr return [retArray autorelease]; } //second variant - (NSArra...
I'm building a simple Cocoa app and I want to direct the audio output to a specific device, instead of the system selected one. I know some apps, like Skype, let you select where to send the output to. How do they do this? I tried the MTCoreAudio framework but I can't even compile my app (or their AudioMonitor demo) with it included and...