Hello!
I've just started development on Macs and have found Cocoa to be a useful and thoughtful framework, but its HTTP functionality has me puzzled.
I have an NSURLConnection object to download a file from my webserver using the HTTP GET method. NSURLConnect's asynchronous connection is great, I get plenty of feedback, I get each chun...
I have an NSTreeController that manages an entity is a core data model and an NSOutlineView that displays this tree.
I would like the tree to display some special nodes that do not correspond to entities in the underlying core data model. How would I go about doing that? Should I subclass NSTreeController?
...
I have two NSTableViews populated with Core Data that are linked using bindings. When a row is selected in NSTableView1, NSTableView2 is populated and the first row in it is selected. I have registered the NSArrayController that corresponds to NSTableView2 with KVO on its selectionIndex. This is so that when a row is selected in NSTab...
I am doing manual layouting for my Cocoa application and at some point I need to figure out what the inner size of a NSView subclass is. (E.g. What is the height available for my child view inside of a NSBox?)
One of the reasons is that I am using a coordinate system with origin at the top-left and need to perform coordinate transformat...
I tried to list all properties of an Objective-C class like described in the Objective-C 2.0 Runtime Programming Guide:
id LenderClass = objc_getClass("UIView");
unsigned int outCount, i;
objc_property_t *properties = class_copyPropertyList(LenderClass, &outCount);
for (i = 0; i < outCount; i++) {
objc_property_t property = properti...
What I'm actually trying to do is put a WebKitView into a ScreenSaver (which inherits NSView). I'm totally new to MacOS X and Cocoa (but I'm very familiar with Objective-C and used some parts of GNUStep). Do I need some laying out? I want to show only one control in the whole NSView.
...
Greetings,
I have a NSTextView with a sizeable quantity of text. Whenever I scroll however, the view isn't updated properly. There are some artifacts that remain at the top or the bottom of the view. It appears that the view doesn't refresh itself often enough. If I scroll very slowly the view updates correctly though. If I add a border...
I have an application written using Core Data. I have 2 entities with a one-to-many relationship. I have subclassed NSManagedObject for both of them. The entity on the one-side is called Playlist and the other is called Song.
The interface for Playlist:
@interface VBPlaylist : NSManagedObject {
}
@property (readwrite, copy) NSStrin...
Hey all,
I'm using key value observing on a boolean property an NSObject method:
-(void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
The most interesting part of the value for this key path is a B...
I'm creating a mainly GUI Cocoa app, but I want to create a command line front end as well that prints the same data so I can display it using geektool.
I'm guessing I need to create an additional command line custom executable in my Xcode project and build it alongside the GUI executable? Is there a tutorial around for how to do this?
...
Would NSSortDescriptor subclasses be placed in the Model or the Controller layer?
Since they are primarily for display and business logic, it seems to make sense to put them in the Controller layer. But it also makes sense that models should know how to sort themselves.
...
I'm looking for open source projects for card games like Black Jack or Solitaire to get an idea on some GUI/Mac OSX desktop programming. I'm curious if anyone knows of any that're based on Objective-C/Cocoa that I can read/learn from?
...
I am going through Cocoa Programming for Mac OS X by Aaron Hillegrass and have come to something I do not understand. On page 150-151 he creates an object, releases it, and then uses it again. For example:
- (void) someMethod
{
NSMutableArray *array = [[NSMutableArray alloc] init];
NSString *str = [[NSString alloc] initWithStrin...
(I have read Apple's memory management guide, as well as other memory management help here, but am still confused on the following)
What should I do for memory management with convenience methods in a loop? Do I need to explicitly create an autorelease pool and then drain it. Or is it all automagic?
e.g.
for (i=0; i<numFilePaths; i++...
I am Developing A Core Data App, and would like to add a feature like the Groups feature in iChat to my App. The Feature would be displayed in the table with normal table rows and more groups could be created. Other rows of the table could be dragged into the Group and the Group could be collapsed and opened. What code would I need to do...
I have an NSTableView and an NSTokenField in a window. I have implemented the following delegate methods:
tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:
tokenField:representedObjectForEditingString:
tokenField:displayStringForRepresentedObject:
I want to make it so that when a row is selected in it, the NSTokenF...
Is it possible to load a view on a background thread?
I am using buffering to render views into a buffer off screen so they can be scrolled into view later. I want to make the UI more response and it seems to be the off screen buffering that is the culprit, and am wondering if I can load up the buffered view on a background thread as I ...
I am using the iPhone SDK and have an issue doing something simple. I am trying to add an NSNumber object to an NSMutableArray instance variable. I tried adding NSNumber card to NSMutableArray viewedCardsArray, however without breaking, it does not get added to the array. Here is the code.
//////////////////////////////////////////////...
I have an NSTokenField in a window. I am using it to store tags related to a Core Data object. Right now I have it set up such that I can add tags to the objects, but I cannot delete them. I need a delegate method on the NSTokenField that can let me know when the user has moved the focus out of the NSTokenField. Since NSTokenField is...
I use CGWindowListCopyWindowInfo to get a list of all windows. It gives me the co-ordinates of each window based upon the origin being the top-left of the screen.
If I use NSWindow's setFrame method, the co-ordinates on based upon the origin being the bottom-left of the screen.
What's a clean, reliable way to convert from one to the ot...