I'm picking up ObjC and Cocoa, which is also my first serious foray into programming in general.
I'm having trouble with the differences between initWith methods, which are called on instances, and factory methods, which are called on classes.
Firstly, why are they called "factory" methods, and is there a proper term for what I've dubb...
I have inherited a new class from NSWindowController to implement windowDidLoad and then access to the NIB defined window controls:
- ( void ) windowDidLoad
{
NSArray * controls = [ [ [ self window ] contentView ] subviews ];
int i;
NSRunAlertPanel( @"windowDidLoad", @"", @"OK", NULL, NULL );
if( [ controls count ] == 0 )
...
Does Cocoa provide a built-in method to convert a key string into a properly-formatted set property accessor? i.e. "lineSpacing" -> setLineSpacing:
For example:
NSString * key = @"lineSpacing";
SEL selector = [key magicallyConvertIntoSetPropertyAccessor];
or even:
NSString * key = @"lineSpacing";
SEL selector = NSSelectorFromString(...
Is Apple declaring method [CIImage initWithImage:(CIImage*)] that I'm not aware of? The only method with that signature that I'm aware of is [CISampler initWithImage:]. But when I tried to provide my own method, the compiler warns me saying that the method already exists.
Background: I'm trying to create a convenience method that conv...
If I use a performSelectorOnMainThread call inside a detached thread, when does the main thread execute the request? Does it do so immediately after it finishes the current main thread operation, or is there some other type of hierarchy that determines when the performSelectorOnMainThread call executes?
...
Hi everyone, how can I make it so all of my view's subviews aren't animated here and only the currentPage's representedView and the newPage's represented view's?
CATransition *transition = [CATransition animation];
[transition setType:kCATransitionPush];
[transition setSubtype:([self indexOfPage:currentPage] < [self indexOfPage:...
Hi everyone, I am making custom NSScrollers for use in NSScrollView. But when any of the superviews of the NSScroller gets Core Animation enabled. I get this drawing issue that's a huge nuisance. Whenever i scroll into the corners of the scroll view the scrollers clip. But if a scroller starts out drawing in the corner, the scroller part...
Hi all,
There is a previous SO post regarding setting up error domains for your own frameworks, but what is the best practice regarding setting up error domains and custom error codes for your own project/app?
For example, supposing you're working on a Core Data-intensive app with lots of validations, should you just stick with the "of...
It used to be that in Carbon you could use SetMenuItemKeyGlyph. What's the alternative under 10.6? Will I need to use undocumented goodness or...?
Thanks
...
Hello,
Is there an easy way to load, play and control an mp3 file from cocoa? Tried googling it, but, as all things apple, i get messy results and have no idea where to start. As i understand, there's and NSSound, but it has lots of limitations and then there's CoreAudio, but it's very difficult. So can someone point me in a right direc...
I am having trouble removing objects from nsmutable array. Here it is.
NSURL *url = [NSURL URLWithString:@"http://www.lockerz.com/dailies"]];
NSData *datadata = [NSData dataWithContentsOfURL:url];
NSString *removeForArray = [[NSString alloc] initWithData:datadata encoding:NSASCIIStringEncoding];
NSArray *theArray = [removeForArray co...
I'm having trouble with a layer hosting view. This version of initWithFrame: works as expected (the view is filled black) providing 'Wants Core Animation Layer' is selected in Interface Builder:
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self setWantsLayer:YES];
[[s...
In a situation where I need to save all data members in a NSDictionary, does it make more sense to put structs (custom types, or even scalars i.e. CGPoint) in my own wrapper (not NSValue), so I can avoid the overhead of encoding/decoding it every time I get or set the member?
For large structs (16 floats) the savings is IMO significant....
I'm trying to figure out if the KVC mechanisms provide any sort of help when dealing with relationship properties which are inverse relationships of each other. I'll use the contrived and standard Department/Employee example.
@interface Department : NSObject {
NSMutableArray *employees;
}
@property (retain) NSMutableArray *employe...
Update! I've created a sanitized test program that illustrates the issue.
Here you can view a PDF of exactly what I've done, and download a .zip of the project
Update2! See the comment thread of Conceited Code below to understand more about this problem.
Update: Added bounty, I'm looking for an explanation of what's actual...
How can I activate Type 1 font that is consisting of files like .pfb, .pfm etc. on Mac in Objective-C? I mean, only for my program, and not for the whole Mac (FontBook) - I just need to activate it, write a text and then deactivate.
I tried ATSFontActivateFromFileReference, pointing it to any of these files - no luck.
Googling didn't he...
Hello.
I want to build a very rough app which will simulate mouse clicks every 10th of a second at random places on the entire screen. I was thinking of building this in Cocoa/Obj-C. Can anyone point me in a direction of research?
Regards.
...
Hi all,
I am newbie to Mac Application Development.I am planning for an application having the features like
de-fragmenting the mac ,parental controls, data backup etc...
I do have some exposure to Objective C (Developed a small application for iphone)
So please anyone could advice me regarding where to start,where to find best re...
Hi,
I try to use the anchorPoint in a layer hierarchy to move a layer with its sublayers. Unfortunately the sublayer did not move together with the root layer. In a custom NSView is set up my layer hierarchy like in the following snippet.
CALayer * rootLayer;
rootLayer = [[CALayer layer] retain];
rootLayer.position = CGPointMake(...);
...
I'm trying to deploy on 10.5 a PyObjC (or Cocoa-Python) application developed on Xcode 3.2.X (Snow Leopard) which runs perfectly fine on 10.6 systems.
The application doesn't launch on 10.5;it crashes at launch giving this error message (found on Crash Report):
Dyld Error Message:
Library not loaded: /System/Library/Frameworks/...