cocoa

Memory-related crash with adding objects to NSArrayController

I'm writing a simple ObjC2.0/Cocoa application, and I'm getting a crash.. Not being familiar with Cocoa or ObjC, I can't work out why.. The code causing the problems is TableListCon.m When I drag a folder onto the NSTableView, it calls addDirectoryToList - which recursively loops over all files contained in this directory, calling addF...

Can someone show me a diagram of how view controllers work?

Can someone show me a diagram of how view controllers work in cocoa (obj-c). I just want to understand because they are confusing me Thanks! ...

How to get the token type from a CFStringTokenizer in Cocoa?

The CFStringTokenizer documentation has two conflicting statements in CFStringTokenizerAdvanceToNextToken(): CFStringTokenizerAdvanceToNextToken ... Return Value The type of the token if the tokenizer succeeded in finding a token and setting it as current token. Returns kCFStringTokenizerTokenNone if the tokenizer fail...

Cocoa Notification Example

Can someone please show me an example of a Cocoa Obj-C object, with a custom notification, how to fire it, subscribe to it, and handle it? ...

How do you give a text field a default font and some padding?

What I am looking to do is change the default font of a text field and give it some padding so that when a person starts typing they will start typing further in from the edge of the text field. Sorry, If my question is quite vague, i don't mean to be, if you need some more information just comment. ...

Why doesn't UIView.exclusiveTouch work?

Hi! In one of my iPhone projects, I have three views that you can move around by touching and dragging. However, I want to stop the user from moving two views at the same time, by using two fingers. I have therefore tried to experiment with UIView.exclusiveTouch, without any success. To understand how the property works, I created a br...

How do you toggle the status item in the menubar on and off using a checkbox?

I have already created a status item for the menu bar but I would like to add a checkbox to make it able to be toggled on and off. So when the check box is checked the status item is displayed and when the checkbox is not checked it is not displayed. What code would i need to do this? ...

Is there a difference between an "instance variable" and a "property" in objective-c / cocoa / cocoa-touch?

I'm not very sure about this. I think that an "property" is an instance variable that has accessor methods, but I might think wrong... ...

Cocoa NSView changing autosizing properties

Using interface builder you can select the corners an object should stick to when resizing. How can you do this programatically? ...

How to do Core Data queries through a relationship?

I'm messing around with Core Data, and I am sure I am missing something obvious, because I cannot find an example that at all resembles what I am trying to do. Let's say I'm playing around with a DVD database. I have two entities. A Movie (title, year, rating, and a relationship to Actor) and Actor (name, sex, picture). Getting all the...

Initialize NSMutableArray: [NSMutableArray array];

If you initialize an NSMutableArray with NSArray's convenience method as above, do you get an NSArray or an NSMutableArray? Any consequences? (I know that NSMutableArray has "arrayWithCapacity:, I'm just curious) ...

[super viewDidLoad] convention

I see some example code with [super viewDidLoad] called before your implementation and after your implementation. I know you don't always have to call super (as seen in many other discussions). When you do call it, is it expected before or after you code? This could have consequences depending on what super's implementation does. Thou...

How do I upload custom images to my tab bar in the iPhone SDK?

How do I upload custom images to my tab bar in the iPhone SDK? I uploaded an image, added it to resources, and tried to make it the image for a tabbar item. This is what happened: http://www.mediafire.com/download.php?tmn1xtnmjhz Thanks ...

What does "@private" mean in Objective-C?

What does @private mean in Objective-C? ...

Move focus to newly added record in an NSTableView

I am writing an application using Core Data to control a few NSTableViews. I have an add button that makes a new a record in the NSTableView. How do I make the focus move to the new record when this button is clicked so that I can immediately type its name? This is the same idea in iTunes where immediately after clicking the add playli...

Make QTMovieView full screen

I have a QTMovieView set up as an IBOutlet. I want to play the video in full screen. Which method allows this? ...

NSURLConnection do not launch

Hello experts! I'm trying to create a very simple app which connects to an URL and gets the contents of that URL, in this case a simple xml document. My problem is that that the request never seems to gets sent. I have created a new project(Foundation tool) which runs from a main file. I have set the delegate of the NSURLConnection to...

How would you make a status item's title be an image not text?

I have created a status item (menu bar item) for my app, but at the moment it's title is text, how would I make it show an image? This is the part of the code which sets the title. What would I need to change to that code to make it display an image? [item setTitle:@"MenuItem"]; ...

Regex solution for Objective-C

What is the best method for using Regular Expressions within Objective-C? There seems to be some open source project that provide regex support, can any one recommend one? Also I looked at NSPredicate, can anyone suggest any regex examples? Background: I want use regex mainly for validation, IP's, email addresses, internal ID's etc ...

macruby: Using ruby method as AXObserverCallback

I trying to watch out for a text field to change, using macruby. AXObserverCreate expects an AXObserverCallback as parameter. How can I pass a ruby function as a callback? My function in AX.m: + (AXError) addNotificationWithElement: (AXUIElementRef) element forEvent:(CFStringRef) event_type callback:(AXObserv...