Tag: cocoa

Suitable key for NSDictionary

Is there a way to determine if a class is suitable as a key and will work as you expect, for example I want to use NSIndexPath as a key in NSDictionary but I don’t know for certain if two different NSIndexPath instances with the same integer values will always return the same hash value.

Connecting Menu Items in Document Based Applications

I’ve already asked a couple questions on this topic, and haven’t really received a real answer on how to do it (it actually received the “Tumbleweed Badge” lol). I have a document based application (meaning the Menu.Xib is separate from MyDocument.Xib). Say I want to add a ‘Bold’ button, or a Check Spelling button (items […]

How do you call a method for an Objective-C object's superclass from elsewhere?

If you’re implementing a subclass, you can, within your implementation, explicitly call the superclass‘s method, even if you’ve overridden that method, i.e.: [self overriddenMethod]; //calls the subclass’s method [super overriddenMethod]; //calls the superclass’s method What if you want to call the superclass’s method from somewhere outside the subclass’s implementation, i.e.: [[object super] overriddenMethod]; //crashes Is […]

How to create an action from selecting a row from an NSTableView

When I select a row from NSTableView, it is not running the code from tableViewSelectionDidChange method. I had put break points in this method and it is not even going into the method. Any ideas? Am I missing something in my initialiser? PersonController.h #import <Foundation/Foundation.h> @interface Person : NSObject { IBOutlet NSTableView *personsTable; NSMutableArray *personsList; […]

What is the main difference between framework and dynamic library

What is the main difference between frame work and dynamic library

Does converting NSString to NSData force a trailing byte?

This is in response to this incorrect answer: https://stackoverflow.com/a/7894952/192819 Does converting NSString like this: NSString *str = @”teststring”; NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding]; force a trailing \0 byte, which means -[NSJSONSerialization:JSONObjectWithData:] and others will fail unless you remove it.

NSDate Min and Max Possible Values

Anyone know what the minimum and maximum possible values are for an NSDate?

How to “validate” a NSTimer after invalidating it?

So basically, I have this timer that should be repeated when it receives a key event, and invalidates when the user releases the key. However, I am unable to “validate” the timer back even by calling the addTimer:forMode: in NSRunLoop. Does anyone know why this is happening and how I can fix this? Thanks.

How to pass the NSString from One UIViewController to Another UIViewController?

Possible Duplicate: iOS – Passing variable to view controller I have two Viewcontrollers (ViewController1 and ViewController2) , And i want to pass a String value along with a IBAction from ViewController1 to ViewController2. I am trying to read the NSString (*check) value in ViewController2’s ViewDidLoad method, but it’s returning a null value. Help me out […]

How do I increase the height of the title bar in a Cocoa application?

I have the following code for setting up my interface in a Cocoa application: #import <Foundation/Foundation.h> @interface uiview : NSObject { IBOutlet NSWindow *mainWindow; IBOutlet NSView *accessoryView;} // Methods – (void)composeInterface; -(IBAction)button : (id)sender; @end #import “uiview.h” @implementation uiview – (void)awakeFromNib { [self composeInterface]; [mainWindow setTitleWithRepresentedFilename:@”/Users/parag/Documents/UIview”]; } – (void)composeInterface { NSView *themeFrame = [[mainWindow contentView] […]