cocoa

IPhone memory problems...

Hi, I am working on an App that is already been made but Memory Management was not considered in the development stages. So what can I do to keep the App memory usage low as soon as I get a memory warning? Is there any general tool or some piece of code that I can use to release any unused memory? ...

Core Foundation equivalent for NSLog

What is the closest Core Foundation function to the functionality of NSLog? ...

How can I make NSCollectionView finish drawing before the view containing it is made visible?

Hello, I'm trying to clean up the UI on my application (built for 10.5) and one thing that's rather annoying is that when I swap to the library I reload the contents and the nscollectionview that displays the items fades the old content out before fading the new ones in. I don't mind the fade in/out of old/new items, but the way i've pr...

Gradual memory leak in loop over contents of QTMovie

I have a simple foundation tool that exports every frame of a movie as a .tiff file. Here is the relevant code: NSString* movieLoc = [NSString stringWithCString:argv[1]]; QTMovie *sourceMovie = [QTMovie movieWithFile:movieLoc error:nil]; int i=0; while (QTTimeCompare([sourceMovie currentTime], [sourceMovie duration]) != NSOrderedSame) ...

How to programmatically allow access to the KeyChain for my application?

Need to avoid the conformation dialog. ...

Cocoa memory management

At various points during my application's workflow, I need so show a view. That view is quite memory intensive, so I want it to be deallocated when it gets discarded by the user. So, I wrote the following code: - (MyView *)myView { if (myView != nil) return myView; myView = [[UIView alloc] initWithFrame:CGRectZero]; // ...

Running and managing NSTimer in different NSThread/NSRunLoop

I'm writing a Cocoa application, with a GUI designed in Interface Builder. I need to schedule background activity (at regular intervals) without blocking the UI, so I run it in a separate thread, like this: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [self performSelectorInBackground:@selector(schedule) w...

Cocoa - calling a VIEW method from the CONTROLLER

Hello everyone, Got a little problem i asked about it before but maybe i didnt ask properly. I have a cocoa application, which amongst other things, must do the following task: - load some images from the disk, store them in an array and display them in a custom view. In the Interface Builder i have a CustomView and an OBJECT that poin...

Subclassing an NSTextField

Given all the complex things I seem to cover every day, this appears to be a "what the heck am I doing wrong that seems to simple?" scenario! I would like to subclass an NSTextField to change the background color and text color. For simplicity sake (and to help anyone who hasn't ever subclassed anything before), here is the example of m...

Closest cocoa equivalent of enum

Is there a Cocoa class has similar functionality to enumerated values from C? I know that I can just use enums in Cocoa, but what if I want to put an enum in an NSArray (which only accepts objects)? ...

how to delete all files in a folder, but not the folder itself?

I try to delete all files including subdirectories in a folder: NSFileManager *deleteMgr = [NSFileManager defaultManager]; NSString *path = @"~/test/"; [deleteMgr removeItemAtPath:path error:&error]; And it deletes everything including the folder itself. But what I expect is an empty folder. Could anyone please help me what did I do ...

How to change the order of opening windows in cocoa?

I had a mutil windows cocoa porject. and now I want to change the order of opening windows , How to do it ? Thank you very much! ...

Accessing objects on one nib file from another nib file

I have two nib files - Main.nib and Preference.nib In Main.nib file I have an instance of NSView class.Its window has a NSPopUpButton which on clicking shows a menu .In the menu I have show Preferences menu item. Menu item on clicking shows a preferences panel containing a color well item. On clicking color well a color panel is displaye...

[NSCustomView isOpaque]: message sent to deallocated instance 0x123456

Hi all I receive that message in debugger console since I added the following arguments for debugging my application with XCode. NSZombieEnabled: YES NSZombieLevel: 16 I was looking for zombie objects... Before doing so, the application failed before I could know where what and why was happening.... Now I´m pretty sure that 'something...

Copy window content between applications on Mac

In my application I have a NSWindow with some drawing which is quickly changing (i.e. animation or video). Also I have another application, emulated via X11, which created GtkWindow. How can I copy all the drawings from the first Cocoa window to the second Gtk one in real-time? Or, let me better divide the question on two parts: How...

any Cocoa control code that I can use that acts as a patch bay?

I would like to make a patch bay type control... any source online that anyone knows of that I could work from? Thanks ...

reading time stamp from files in Cocoa?

I want to read when a file is created (or last modified) as it showed in Finder "Date Modified." Is there any existing method in Cocoa can do so? Thanks! ...

Is there a way to present a modal view that extends outside of the bounds of the view that is presenting it?

I have a subview of a split view that is presenting a modal view but I need the modal view to take up the entire screen, not just the bounds of the presenting view, is there any way to do this? ...

update UIProgressView.progress in VC-B with values generated in VC-A

- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { progBarReturn = (float) totalBytesWritten / totalBytesExpectedToWrite; Since that is a void delegate method. General qu...

Objective-C/cocoa losing array values

I have multiple arrays, however, they are not retaining their data for use in another method. Here's how I have it set up (simplified) .h NSArray *array; @property (nonatomic, copy) NSArray *array; -(void)someMethod:(NSArray*)someArray; -(void)heresNewMethod; .m -(void)someMethod:(NSArray*)someArray { array = [someArray copy]; } ...