cocoa

Search is only matching words at the beginning.

In one of the code examples from Apple, they give an example of searching: for (Person *person in personsOfInterest) { NSComparisonResult nameResult = [person.name compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])]; if (nameResult == NSO...

how to change height of window title bar in cocoa?

there some applications with larger window title bars than in "Interface Builder". for example "Things" application. So how can i do this? ...

NSDocument and keyboard (like keyDown)

Hi to all, I've tried to read on apple documentation but I can't find anywhere how to capture key event (space or other) into an NSDocument application. With initialFirstRepsodner if I've understand well it's not possible to do. Any idea? thanks to all! Andrea ...

iPhone CGRectMake memory consuption

On iPhone.. Why would code such as this cause memory leak? after 2 minutes the net bytes have doubled. All I'm doing is moving a ball round the screen with an NSTimer calling the below method. Any ideas? - (void)nextFrame:(NSNotification *)notification { ballInstance.frame = CGRectMake(value, 0, 320, 480); } ...

NSTimeZone: what is the difference between localTimeZone and systemTimeZone?

Under NSTimeZone class, there is both +localTimeZone and +systemTimeZone. I did a test on iphone simulator, both return NSTimeZone object indicating the same timezone. What is the difference? Which one I should use to find out the timezone setting of the iPhone? Thanks My test: NSLog(@"Local Time Zone %@",[[NSTimeZone localTimeZone] na...

How can I track down a segmentation fault in a Cocoa application?

I'm having a problem with a Cocoa application I am writing. It has to parse a timestamped file that is updated every hour, and during testing it keeps crashing consistently at around 11:45 PM due to a segmentation fault. I'm assuming I must be messaging an object that has been deallocated. What tools are provided with the Xcode install t...

How to create a transparent window with non-rectangular buttons?

I am looking to make a custom window which would look something like this (never mind the quick photoshop): The main problem I have is not to make the window transparent (although I guess any info is welcome!), but that I want to be able to click only on the visible part of the buttons. For example, if I click just outside the top lef...

How to create an NSFetchRequest which filters Core Data objects based on attributes AND relationships?

Hello! I have a Core Data model setup like so: Blockbuster Entity To-Many relationship to DVD entities. DVD Entity title attribute (string) To-One relationship to a parent Blockbuster entity A single Blockbuster can have multiple DVD's inside of it (To-Many). Each DVD can only be part of a single Blockbuster (To-One). There ar...

NSLevelIndicator - Cocoa

Hey all, How would I be able to use a NSLevelIndicator? I am very new to this so, I don't know much on how to use a progress bar for my application. Thanks, kEvIn ...

NSNumber of seconds to Hours, minutes, seconds

I am having a terrible time trying to do something that should be easy. I have a NSNumber value of 32025.89 seconds. I need to represent that in Hours, Minutes, Seconds. Is there a method that spits that out? I can't seem to find a proper formatter. ...

Code Example: Why can I still access this NSString object after I've released it?

I was just writing some exploratory code to solidify my understanding of Objective-C and I came across this example that I don't quite get. I define this method and run the code: - (NSString *)stringMethod { NSString *stringPointer = [[NSString alloc] initWithFormat:@"string inside stringPointer"]; [stringPointer release]; ...

how to write back to an existing file, ensuring the bits on the disk get overwritten in OS X

What API's Cocoa or Core Foundation, can I use to make sure that when I write back to a file that already exists on the storage device, that the bits get written over? The idea is to clear out the bits for security reasons. ...

Why do I have to call showWindow on my NSWindowController twice on 10.5?

I've got a subclass of an NSWindowController that I'm using to load a window from a nib and show it on the screen. Below is the code that is called when I want to show the window. On 10.6 when showCustomWindow is called the window is displayed, but on 10.5 this method has to be called twice to get the window to display. -(IBAction)sho...

NSBorderlessWindow not responding to CMD-W/CMD-M

I have an NSBorderlessWindow subclass of NSWindow with a transparent and non-opaque background (so it's non-rectangular in appearance). I've added my own buttons to function as the close and minimize buttons when I click them, but for some reason the window will not respond to CMD-W or CMD-M like a normal one does. I have my NSWindow sub...

Changing the userAgent of NSURLConnection

Hey I am using a NSURL Connection to receive data. [NSURLConnection sendSynchronousRequest: //create request from url [NSURLRequest requestWithURL: //create url from string [NSURL URLWithString:url] ] //request parameters returningResponse:nil error:nil ] Is it possible to change the user agent string? right now it is: AppName/...

What should I make sure I do when migrating from manual sqlite to Core Data?

Hi, I've got a medium sized project (about 20 critical classes) where I'm using sqlite for my data store. All of my objects and data structures comply with the NSCoding protocol. I've been reading up on all the great bells and whistles Core Data has to offer and would like to migrate my app to use Core Data. The bells and whistles i'm...

Does the IKImageView imageCorrection property work?

IKImageView offers an 'imageCorrection' property, which takes a CIFilter and, presumably, uses it when displaying the image. When I tried using it recently, it didn't work for me. When I set the property to a new CIFilter instance, it remains nil. Has anyone managed to use this successfully? ...

Why should I release (and therefore dealloc) objects just before application quit?

There are plenty of objects in each iPhone app witch will live forever till app dies. They are: application delegate, window, main view controller, may be navigation or tab controller, all the objects within them. Why on Earth should I release them just before quit spending precious CPU cycles? As far as I understand, apps process will b...

NSRunAlertPanel() outside of the main thread?

I've stumbled upon a problem in the application I'm developing using cocoa. I need to do some processing, and I'm doing it on a separate thread. I'm doing this so I can display the progress using a NSProgressIndicator and not hang the main thread. (The user can cancel the execution if he/she wants). It's almost working perfectly, But th...

Built-in password authentication dialog in Cocoa?

Is there a built in username/password dialog box in Cocoa? I don't want to reinvent this if there's a standard way of doing it, but after googling, I came up with nothing. I often see that lock image with the application image superimposed on it, so I thought there might be something. ...