cocoa

Non-spaced method definition style

Hi, people. I study Obj-C and Cocoa now, and I was wondering: why everybody writes method definitions/implementations like this: - (void)translateOriginToPoint:(NSPoint)newOrigin{ - all together, no spaces. For me, it's way more clean to write everything with spaced like this: - (void) translateOriginToPoint: (NSPoint) newOrigin { ...

Infinite source rectangle to drawImage method

Why do i always get this log, Infinite source rectangle to drawImage method, is this such an error or there's something wrong with the code algorithm. I don't really understand about this, and i can't find any useful information on google. Hope i can find the answer on this site. sorry, this is my drawRect method : - (void)drawRect:(N...

Can't see why there is a memory leak here

I have the following block giving me problems in the performance tool: Particularly it is saying STObject is leaking. I am not sure why? for (NSDictionary *message in messages) { STObject *mySTObject = [[STObject alloc] init]; mySTObject.stID = [message valueForKey:@"id"]; [items addObject:mySTObject]; [mySTObject rele...

Time each CPU core spends in C0 power state

The title says it all. Any help figuring out how to do this would be great: How much time each CPU core spent in the C0 power state over the past second. This is for a mac app so Objective-C, cocoa and c are needed. Thank you! ...

NSTableView jumps on selection… why?

I've got an NSTableView with a single column, populated with NSTableViewDataSource methods (no bindings involved.) The NSTableView is inside an NSScrollView, as is the default behavior when you drag an NSTableView in from the library in Interface Builder. The contents of the tableview are populated based upon a search string that the use...

Hiding NSTableView header?

How do I hide an NSTableView header completely, so that it does not take any space up? ...

Syntax to Access XML Element's Text Value

Please remove question ...

How can I track opening and closing event of NSWindow?

I did try – windowDidExpose: but it didn't work. What do I have to try for this? My window is a utility window. -- edit for more clarity -- What I want are: viewWillAppear viewWillDisappear viewDidLoad viewDidUnload in Cocoa Touch. ...

Delaying Cocoa NSDocument creation at startup

I have a document-based Cocoa application that has to start up a sub-process before running. It would be best if that process could finish starting up before I display any document windows. I get a notification when the process has fully started. How can I delay the creation of the untitled NSDocument subclass object until the notific...

saving an array

how is it possible to save an array in multiple locations ie. different view controllers in order to save the data in the arrays and allow it to be used afterwards by a table? edit objective c i have an ibaction with code [[NSMutableArray alloc] init]; [favoritesArray addObject: @"one"]; //and in the fav table view this code// favori...

Can I include a framework in another framework?

I'm writing a framework (called Lighthouse.framework) that, in turn, uses code from another framework (RegexKit.framework, to be precise). I have copied RegexKit.framework into my own framework, so that it has a structure like the following: Lighthouse.framework/ Versions/ A/ Frameworks/ RegexKit.framework Ligh...

RSA and xml-formatted public key in cocoa

How can I fill RSA structure with xml-formatted public key for using with RSA functions on Mac OS X. In other words: There are following windows c# statements: RSACryptoServiceProvider rSA = new RSACryptoServiceProvider(); rSA.FromXmlString(xmlKey); return rSA.VerifyData(Encoding.UTF8.GetBytes(message), "MD5", signature); how can...

Can't create an NSImage?

Whenever I do: xxx = [NSImage imageNamed:@"Package.png"]; xxx loads but it's width and height remain 0. And whenever I try loading it into an NSImageCell I get this error: NSImageCell's object value must be an NSImage. Can someone help me out? I've never had this problem before. Edit: Sorry, I've missed this bit out. So when I ...

Obtain kMDItemKind on files inside bundles returns nil

For some reason I cannot do this on files inside bundles and files residing on different volumes. Am I the only one experiencing this problem, and if not how do I solve it? The Finder seems not having difficulties showing spotlight properties for the same files that I'm experiencing problems with. I want to obtain the kMDItemKind of ...

NSDecimalNumber for intensive scientific applications?

Let's say I'm writing a "DayData" class, containing the ivars NSString *symbol; //such as "AAPL" NSString *currency; //such as "USD" NSDate *day; double open; double high; double low; double close; The last four ivars are the open,high,low,close prices of that stock for that day. Say I'm using this class as the fundamental building-...

Mac: How do i add context menu option in Finder for associated Cocoa application files?

Hello, On Mac i have a Cocoa application that associates it's file type with a specific extension. When user double clicks on such files my application is launched with a file name as a parameter. Think of it like when you double click a pdf file the pdf viewer application is launched to display the pdf. What i need now is to add an o...

array sorting error unknown cause

hello i have this array that compares two arrays to see if it contains an object however after testing it with nslog NSLog (@"1"); favoritesArray = [[NSMutableArray alloc] init]; NSLog (@"2"); //Add items // favoritesArray = [[NSMutableArray alloc]init]; didContain = [[NSMutableArray alloc]init]; NSLog (@"3"); if ([favoritesArray cont...

NSView overlay passes mouse events to underlying subviews?

I have a loading overlay which is supposed to block all the AppKit Controls off untill loading is done. However the view seems to be passing all the mouse events to the underlying layers. How to disable that? ...

Does it matter when super is called in dealloc?

- (void)dealloc { [super dealloc]; [receivedData release]; receivedData = nil; } or - (void)dealloc { [receivedData release]; receivedData = nil; [super dealloc]; } ...

NSTextView: How to be notified when user pastes data?

I need to be notified when the user pastes data into an NSTextView in order to strip it of any disallowed data types (url links, etc). I don't want to use NSTextStorageDelegate's textStorageDidProcessEditing: because it is called when the user is just typing. How can I be notified of pastes only? ...