cocoa

The right way to delete file to trash in Snow Leopard using Cocoa ?

I mean the right way must able to "Put Back" in Finder and isn't playing sound Here are the methods I tried so far: NSString * name = @"test.zip"; NSArray * files = [NSArray arrayWithObject: name]; NSWorkspace * ws = [NSWorkspace sharedWorkspace]; [ws performFileOperation: NSWorkspaceRecycleOperation source: @"/Users/" ...

forward invocation, by hand vs magically?

I have the following two class: //file FruitTree.h @interface FruitTree : NSObject { Fruit * f; Leaf * l; } @end //file FruitTree.m @implementation FruitTree //here I get the number of seeds from the object f @end //file Fruit @interface Fruit : NSObject { int seeds; } -(int) countfruitseeds; @end My question is at th...

Make a Cocoa applicaion quit when the main window is closed?

How to make a Cocoa applicaion quit when the main window is closed? Without that you have to click on the app icon and click quit in the menu. ...

Change animation time for properties of a CALayer.

I have a CALayer to animate a change in its image contents. Now, how can I change how long it takes for this animation to take place? ...

Loading contents of TableView Controller after showing Tab

Hello, I have a 4 tabbar application. The second tab has a tableviewController. When i select the second tab the tableview is displayed with it's contents and it works fine. The problem is that that data is comming from the network and it talks 2-3 seconds to load. So when i press the second tab it goes there after the contents have be...

NSpredicate not working if string starts with #

Hi, NSString *newValue = @"#xyz"; but the following searchPreidate is not finding that. pls let me know how to solve this self.searchPredicate = [NSPredicate predicateWithFormat:@"(value contains[c] %@) OR (title contains[c] %@)",newValue, newValue]; ...

how to implement Splitview in cocoa application?

I am iphone developer but now i am implementing cocoa application.I am new for this cocoa application.I want learn cocoa development application.I want to learn step by step all controllers.First i want to learn splitview controller.Please help me for this .Please provide me some related document or sample example for this.Thanks in adva...

how to get indexnumber form the NSCombobox ?

i have implemented nscombobox now i want to get indexnumber on selected item ow it possible? ...

Snow Leopard & LSUIElement -> application not activating properly, window not "active" despite being "key"

Hi, I'm running into a few problem with a background application that uses LSUIElement=1 to hide its dock item, menu bar and prevent it from appearing in the Command-Tab application switcher. It seems to be a Snow Leopard only problem. The application places an NSStatusItem in the menu bar and pops up a menu when clicked on. Selecting...

Core Animation 'flip' animation

I'm looking to use Core Animation to simulate a flip clock animation in a Mac application. Currently I have three CALayer's representing the top and bottom half of the digit, and a third used to represent the flip animation (a solution found in the follow article: Creating an iPad flip-clock with Core Animation. The animation of the fli...

Equivalent Carbon 32-bit call for using in 64-bit application - GetApplicationEventTarget().

Hi All, I'm writing a 64-bit Cocoa application. I need to register for global key events. So I wrote this piece of code : - (void)awakeFromNib { EventHotKeyRef gMyHotKeyRef; EventHotKeyID gMyHotKeyID; EventTypeSpec eventType; eventType.eventClass=kEventClassKeyboard; eventType.eventKind=kEventHotKeyPressed; eve...

iPhone UIImage number recognition

Hi All, I have a small UIImage (jpg) with a single typed number. I want to be able to read the number with some kind of pattern recognition. I'm really not sure where to start, so any help would be appreciated. my initial idea was to compare this image with other images. For instance compare the image with that of a 1,2,3, etc until a ...

IBOutlets are always nil

Hi, I added an object to my .nib and I connected IBOutlets to it. But the object doesn't initiate the .nib. Another object does that. When I initiate the object added to my .nib (from somewhere in my code), then all IBOutlets are nil, even if the nib has been loaded. What am I doing wrong here. ...

didReceiveDataOfLength: Problems in cocoa

Hello, Im trying to get the amont of data downloaded with this - (void)download:(NSURLDownload *)theDownload didReceiveDataOfLength:(NSUInteger)length code from apples website but I need to convert the length to a string. How might I do this? Thanks in advance ...

iPhone - nested views & controllers

Is it possible to have a single iPhone screen with its view loaded from a xib by that screen's UIViewController, but then another UIView within that screen with content loaded from a separate xib file? If so, is it possible to have that nested view's events handled by a separate custom UIViewController subclass from the rest of the scre...

Saving files in cocoa

Hello, Im sure this is a really easy to answer question but I'm still new to cocoa. I need to save my applications data. The app has 4 text fields and each field needs to be saved into one file. Then when you open the file it needs to know what goes in what field. Im really stuck with this. Also, I do know how to use the save panel. Tha...

Adding an NSTextField as a subview

I'm trying to add an NSTextField as a subview of a custom view class I have (which subclasses NSView), and then make the text field the first responder. This works fine... the text field shows up and I can start typing in it. However, any mouse events in the text field seem to fall through to its superview. For example, I can't see th...

"Finding" an object instance of a known class?

My first post here (anywhere for that matter!), re. Cocoa/Obj-C (I'm NOT up to speed on either, please be patient!). I hope I haven't missed the answer already, I did try to find it. I'm an old-school procedural dog (haven't done any programming since the mid 80's, so I probably just can't even learn new tricks), but OOP has my head sp...

Processing potentially large STDIN data, more than once

I'd like to provide an accessor on a class that provides an NSInputStream for STDIN, which may be several hundred megabytes (or gigabytes, though unlikely, perhaps) of data. When a caller gets this NSInputStream it should be able to read from it without worrying about exhausting the data it contains. In other words, another block of co...

Copy contents of Directories but excluding subdirectories in Cocoa

In Cocoa, is there any way to copy all the files in a directory without copying the directory's subdirectories along with them? ...