cocoa

simple NSMutable array question....

umm So simple question here: I have an instance of NSMutableArray declared in my header NSMutableArray *day19; @property (nonatomic, retain) NSMutableArray *day19 implementation: @synthesize day19; In my viewDidLoad self.day19 = [[NSMutableArray alloc] init]; In the myMethod where I want to add objects to the array I: NSObjec...

Cocoa magic? Where is my XIB being loaded?

Hello, I'm trying to understand how Cocoa does its thing. The Cocoa Template's App Delegate file is this: #import "Dataminer_ClientAppDelegate.h" @implementation Dataminer_ClientAppDelegate @synthesize window; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your applicati...

Key-Value Coding and Key-Value Observing use case?

what are some of the popular use cases for using KVC and KVO? I'm not quite getting it. Is it an objective C thing? or Cocoa thing? or a Coca Touch thing? Can an iPhone app use KVC KVO? Thanks! p.s. I already read the doc here: http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObservin...

Clipping NSImage around certain NSRect

I have an NSImage with different images inside it. The positions of the images inside of it will stay the same all the time, so I need to specify a rectangle to get a subimage at the position of the rectangle is inside of the image. How could this be done? ...

How do I increase the width of an NSScroller in a WebView

I am developing a web browser for a touch-screen kiosk and the scrollbars on the WebView are impractically small for being able to scroll using them on a touch-screen. Is there anyway to increase the size of them? I can get a reference to the vertical scroller using [[[[[webView mainFrame] frameView] documentView] enclosingScrollView] ...

Cocoa/ObjC: Are there any performance drawbacks to my style of allocing objects for property iVars?

I use properties pretty much anytime my classes need iVars. For retained properties, I have grown accustomed to a specific way of using the accessor methods to alloc/initialize the actual iVars: - (void)anInitOrAccessorMethod { self.property = [[AClass alloc] init]; [self.property release]; } Anytime I need to set a non-autoreleas...

How can I tell NSTextField to autoresize it's font size to fit it's text?

Title says all. :) Looking for essentially whatever the Cocoa equivalent of [UILabel adjustsFontSizeToFitWidth] is. ...

Decoding integer and other masks in Cocoa

Cocoa has a plethora of integer masks and codes. For instance, NSCommandKeyMask or NSF1FunctionKey, which are clearly defined and documented in the headers. However, some can be archaic and when accessing accessibility attributes, for instance to get the glyph (AXMenuItemCmdGlyph), you're given an integer number like 111, which represen...

Is there any way to serialize / unserialize an Objective-C block?

I'm writing an app where support for "promotions" is required, and these promotions could be arbitrarily complex and many different pieces of data might be relevant in their calculation. Therefore, whilst in the early stages of development, I don't want to invent a whole specification schema for these things, I'd rather just write each ...

Key-Value Coding and methods calling.

It's a question about good programming techniques with Cocoa. When you want to call a method on one property of your class, should you use KVC to get the receiver or just put the name of your property? Example, KVC: [[self property] myMethod]; Example, simple: [property myMethod]; Thanks! ...

Loading a XML file and injecting data into a table and return it as a navigation/tableview

So here's the situation: I have a friend who wants me to make an app for his comic website, he wishes for me to set it up so the comics appear in a tab (navigation and tablelist/view). Im not sure what the best method for his XML file is, i do know of the xml code on how do it, but unfortunately, i do not know nor have ever used the code...

cocoa file association question

I've associated a file type with my application via application properties and by implementind the necessary NSApplication delegate methods. Everything seems to work, but ... this confuses the system. How do i make sure that the files are only associated to the copy of the app that is in Applications folder and not the developement versi...

cocoa open multiple files with associated app

Hello, I have an array of filenames that i would like to pass to an external application for opening. I'd like to do one of the following: a) Somehow instruct OSX to open all these files with an associated application, but it must invoke the target app's openFiles NSApplication delegate method b) Specify the application to open these f...

New NSString substringWithRange: Error Message

I'm getting an interesting new error with iOS 4: -[NSCFString substringWithRange:]: Invalid range {11, 4294967295}; this will become an exception for apps linked on SnowLeopard. Warning shown once per app execution. The error is caused by a snippet of code I got from a blog post that helps Title Case a string, and it's not going to be ...

Objective-C "private" protocols?

I got a view controller class (MyViewController) that deals with a UIView subclass (MyView). I don't want to let any class except the view controller class know about the UIView subclass, so I cannot import MyView.h in MyViewController.h. So, in MyViewController.m, I put #import "MyViewController.h" #import "MyView.h" @interface MyVie...

Creating a framework within an application?

I have a cocoa application which has certain subroutines / methods. So if I have a method like this: - (void) dummyMethod:(NSObject*)dummy { //code } Can I call it from an outside application providing I have the correct headers? I mean linking an application with another application. That method is an instance method by the way. S...

Programmatically determine if a Cocoa object loaded from nib/xib is available

The setting is the following: I have a cocoa object in a nib file that is loaded when the NSWindow and view is loaded The window can be closed I also access the object programmatically Now what happens in some situations is that I get a crash, when I try to send a message to the object, but it has been deallocated before (because the...

custom list control in cocoa

Hello, I am trying to get something like in this screenshot in cocoa, I mean a custom list control. Do you know how this kind of things can be done? Thanks in advance for your help, Regards, ...

get app icon from window id in cocoa

I am looking for a way to get the application icon from a window id in cocoa. Do you have any pointer for this? ...

Is it possible to implement mutliple NSUndoManager for one NSWindow?

Hi, I have a window with multiple views (they all subclass NSView and there is always only one visible) on which i draw paths. I'd like to have an NSUndoManager for each view, but obviously they all have the same NSUndoManager, coming from the NSWindow. Is this even possible? Thx xonic ...