cocoa

Application:openFiles: separate files by groups

I need that my application detect how many files has been dropped to it dock icon. For this i use application:openFiles: method - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { NSLog(@"%d",[filenames count]); } But unfortunately files sometimes separates by group. So, for example i dragged 3 files to dock...

How can I make a status-bar only Mac application?

I'm very new to developing for the Mac, and I'm trying to write a Cocoa application whose only presence is in the system menu bar, and does not appear in the Dock. Dropbox, Alfred, and Quicksilver do this (or can be configured to do this). Thank you. ...

Objective-C: window undeclared

Hello! It will be a noob question, but i'm getting crazy with this. I've read a tons of topics but i think i am missing something main. I`ve created new cocoa app project, did not change anything, just add next code to main.m int main(int argc, char *argv[]) { NSView *superview = [window contentView]; NSRect frame = NSMakeRec...

Move directory to trash

I need to move directory with all content to trash. I find in documentation NSWorkspaceRecycleOperation operation, and wrote this code: NSString *path = [NSString stringWithString:@"/Users/test/Desktop/test"]; NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; [[NSWorkspace sharedWorkspac...

UDP how can two computers that are on separate networks connect to each other?

Hey guys I had some questions about udp networking. First of all how can two computers that are on separate networks connect to each other? I know that you can do this with port forwarding but I know things like xbox live don't work through that. How is this possible and is there a way to obtain an address to another computer on a separa...

In Cocoa, is there a way to add an outlet to an array in the File's Owner?

In Interface Builder it is easy to connect an object from the NIB to an outlet in the File's Owner. However, my File's Owner is going to hold an array of sub-views, so I would like to instead add an object from the NIB to the File's Owner's array. Right now i'm just doing it by hand by checking the classes of each item from the top level...

How to use c array as instance variable in an object in Objective-C?

I want to declare a c array as an instance variable (e.g. int arr[256]) in the interface block of a Cocoa object. I know that @property doesn't support c arrays but how to manually add the getter and setter for the c array and where should I alloc and release it? Any input will be appreciated. I really don't want to use NSMutableArray f...

problem with properties of IB plugin object

Hello I have some object witch I represent in IB Plugin. It is controller object with some properties; For test this object I do next: 1 in IB I set value of properties un Inspector View (it is work); 2 I bound my Object from IB to another object using 'New Referencing OUTLET' 3 Now I want saw some value witch I set of my obj from...

How to efficiently set Cursor for an NSView?

I have an NSView that is drawing a collection of irregularly shaped (and overlapping) application managed objects: that obviously can't be described by efficiently using non overlapping rectangles. I want to change the cursor when it it over one of these objects. The usual method seems to be to set up tracking rects in response to -(vo...

Resize JPEG and save new file to JPEG on Mac OS X using Cocoa

I am a bit confused about what the best approach is to resize a JPEG file on disk and save the resized JPEG as a new file to disk (on Mac OS X with Cocoa). There are a number of threads about resizing, but I am wondering what approach to use. Do I need to use Core Graphics for this or is this framework "too much" for a simple operation a...

How to edit EXIF, IPTC and XMP metadata in cocoa?

Hello All, I want to read and edit EXIF, IPTC and XMP metadata of an images using cocoa. I can read the EXIF metadata using NSBitmapImageRep * imageTest = [NSBitmapImageRep imageRepWithContentsOfFile:filePath] ; NSLog(@"Exif Data in %@ : %@",fileName, [imageTest valueForProperty:@"NSImageEXIFData"]) ; How can I modify this data? ...

How to save the value of properties in a custom IB Plugin

How can I save a value set with an IB plugin? Problem - I set a value of some custom object in the IB Inspector. When I close the IB file and load it later this value disappears. Why? ...

Core data file size

Hi, I'm looking into storing lots of number as Int16. Considering Core data because the rest of the models are implemented in Core data. So I did a simple application. Core data with 1 entity and 1 attribute of Int16 type. Inserted 1 million entries in SQLite storage type and the file size turns out to be 16.2MB. Actually if I change ...

How can I remove value that was previously registered via [NSUserDefaults registerDefaults:] call

I have bunch of preference values registered via [NSUserDefaults registerDefaults:] call on application startup. I need to replace them at some stage with new ones but new values scope (keys set) is less than initial one. So after I call [NSUserDefaults registerDefaults:] again I have new values with some old that weren't replaced. Is th...

What are the most useful Xcode plugins?

What are the most useful plugins that you have found for Xcode? I'm looking for ones that help to cut your development times. I'm already using ciaran's xcode-bracket-matcher myself, but I would be interested in any others that people have found to be helpful ...

Interface Builder NSStaticText value needs to be updated every time anything changes in dialog

I have a modal dialog thats building a string. The string is shown to the user, and the user presses checkboxes, radio boxes, etc to build the string. The string exists nowhere - I build it for display in -()builtString; from the configuration of the self.valuesDict. I can easily wire up the checkboxes via bindings in IB: for example to...

Change cell content in NSTableView before editing

Hi everybody, I have an NSTableView that allows inline editing on one of its cells (NSTextFieldCell). This actually works well, but the point is: I want to manipulate the content for the editing session. Imagine having a string with a path (say: "folder/subfolder/myfile.txt") as the content of such a cell. But when the user enters edit m...

Categories and instance variables

I am attempting to add a category to NSMutableArray to allow me to use it as a 2D array (backed by the 1D array, with a method to convert x & y indexes into a flat index). As I am not allowed to add instance variables to a category, how should I keep track of row and column counts which are required to calculate the index into the array?...

Objective-C String Differences

What's the difference between NSString *myString = @"Johnny Appleseed" versus NSString *myString = [NSString stringWithString: @"Johnny Appleseed"]? Where's a good case to use either one? ...

Get all Users on OS X

So I want to implement Parental Controls per user in my app, but I need a way of getting all Users and add them to an NSTableView. These users should be the same displayed by the Login Window, excluding the Other... one and system users. Any ideas on how to do this? Also, I want to be able to get the selection on that table view and of ...