cocoa

Pattern for Ownership and References Between Multiple Controllers and Semi-Shared Objects?

For example, I have window (non-document model) - it has a controller associated with it. Within this window, I have a list and an add button. Clicking the add button brings up another "detail" window / dialog (with an associated controller) that allows the user to enter the detail information, click ok, and then have the item propaga...

When would initWithFormat:arguments: be used?

The NSString method initWithFormat:arguments: takes a va_list as an argument. I can't figure out when it would be used (or even how to use it). Why would Apple add such a method when the regular initWithFormat: is much more user-friendly? ...

UIView has no events

I want to be able to connect the touchUp event of my UIView to an IBAction, but I can't see any events. I thought that there was a subclass of UIView that did have actions. ...

NSMenuItem's value binding with BOOL

Hi, I am having some issues binding an NSMenuItem's "value" binding to a BOOL. I simplified the problem to this: 1) The menu item must call the action method that changes the value of the BOOL otherwise it doesn't work (i.e. if an NSButton calls a method that changes the value of the BOOL then the menu item won't update) 2) Even if ...

Am I not understanding Obj-C at all? Why won't this NSLog message display?

main.m #import <Cocoa/Cocoa.h> int main(int argc, char *argv[]) { return NSApplicationMain(argc, (const char **) argv); } CoolClass.h #import <Cocoa/Cocoa.h> @interface CoolClass : NSObject <NSApplicationDelegate> { } - (void) applicationDidFinishLaunching : (NSNotification *) aNotification; @end CoolClass.m #import "CoolC...

WebView Scroll Issue

Hi All, I am using web-view in my application and showing a message content in HTML format When I try to forward a long message I am setting the web view editable. In this case the scroll of web-view is not working properly means.. when I am pressing Enter after first 2-3 lines then those lines go upward from viewing before I reach th...

Determine AFP share from a file URL

I writing an application to copy some files to a certain location. It allows the user to choose the destination, which is always on an AFP share. This is done with a NSOpenPanel. The URL that gets returned is: file://localhost/Volumes/Oliver%20Legg's%20Backup/. What I want to accomplish is when the application is started, if the AFP sha...

Cocoa AsyncUDPSocket framework, (long)tag variable explanation and my delegate only sometimes called.

Hello Community, my first post and also my first question. I am currently playing around with the Artnet protokoll, which is based on UDP. Trying to develop an Cocoa Application that reads Artnet data. I decided to use the AsyncUDPSocket Cocoa framework and got it working somehow.. So when i try to send a packet to my listen port using...

Location on screen of location in NSTextView

Hi, I want to get the screen location (NSPoint) of a point in an NSTextView, this should be simple, but by results are always a bit off, the X is perfect, but the Y seems to vary. I've tried a few variations of the code below, but can't get the result I'm after, is the NSClipView screwing it up? NSPoint p = [[self layoutManager] locat...

Convert 32 bit CGImage to 24 bit?

Trying to convert a 32 bit CGImage to 24 bit and would like to avoid packing it byte-by-byte. Surely there must be a more efficient way ...? Have tried a couple of things like creating a 24 bpp NSBitmapImageRep like this: NSBitmapImageRep* image24 = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil pixelsWide:width ...

Cocoa:CoreData - Multiple entities in a ManagedObjectContext

Hi, I have two entities which I modeled as classes and core data model entities too/ The classes look as follows: Class: StateManager #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> #import "StateManager.h" #import "Constants.h" @implementation StateManager @synthesize deviceID, physicalID, applicationName, applic...

How to change only font size for the whole styled text in NSTextView

I need to set a text size (for example to 42) of the selected rich text which uses multiple fonts. I imagine I can check attributes of each group of characters, modify the font size and set attributes back, but looking at the floating Font panel it seems like there should be a very easy and straightforward way to accomplish that. Do I ...

Cocoa : How to make a small toolbar like in Pages or Numbers?

Apples Application like Pages and Numbers always show an additional small Toolbar under the main Toolbar. Is there an object like this in the Interface Builder or do I have to build it from scratch? I looked in the IB Library but found nothing so far. ...

Run a Bash script as root with Objective-C / Cocoa

Given that there is a file called copystuff in the Resources folder in a an xCode project, and that file reads: #!/bin/sh cp -R /Users/someuser/Documents /Users/admin/Desktop And if this bit of code below is linked to a button in IB ... it will copy the /Users/someuser/Documents directory to /Users/admin when the button is pressed in ...

Why cocoa dont use same enum declaration style everywhere ?

I was wondering what is the rationale behind different styles of enum declaration on cocoa? Like this: enum { constants.. }; typedef NSUInteger sometype; Is the reason to use typedef to get assigments to NSUInteger to work without casting? Sometimes the typedef is either of NSInteger/NSUInteger, why not use NSInteger always? Is th...

catch system information using macruby or ruby cocoa

Hi, Could you tell me plz - how to catch system information like os version, installed apps versions, hardware details using macruby or ruby cocoa? ...

Taking decision on command line parameters in a cocoa applications

Hi there I have my Cocoa Application, which will be called with or without parameters in the command line. I would like to take decisions over the parameters received on the application, ie, if a special parameter is received I would like to trigger an action on it. Is there anyway for doing this?? Cheers ...

Objective-C Preferences Window makeKeyAndOrderFront or showWindow?

Hello everybody, I'm working on a new Mac App and want to open my Preferences Window, i've got 2 Nib (xib) Files, one for the main window, and one for the Preferences Window, then i've got a openPreferences Action, which shows the Preferences Window, sth. like this: - (IBAction)openPreferences:(id)sender { PrefCont *cont = [[PrefCo...

Offset on UIWindow addSubview

I've got a UITabBar based application that works just fine. Under certain circumstances I am showing a different UIViewController instead though. Now what bugs me is that that I have to adjust the frame for the Test nib (and only the Test nib!) to display correctly. (Otherwise the view is below the status bar). - (void)applicationDidFin...

Cocoa NSWindow with 2 toolbars

Is there any way to have 2 toolbars in one NSWindow. Something like Pages. With one large on at the top, and a smaller one below that. ...