Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread Display Modes
Old May 4, 2013, 03:47 AM   #1
macrumors regular
Join Date: Dec 2012
How can I add custom attributes to interface controls?

I'm trying to give some extra data to some controls I'm putting in a dialog box. However, the "User Defined Runtime Attributes" entry from the Identity Inspector of Xcode XIB editor requires the class to have those properties defined. First, I tried creating categories for those controls, but Interface Builder (and the program in general) doesn't detect the new properties defined in the categories. Then, I subclassed the control classes (in this case, NSTextField and NSButton), the program started properly, but the controls looked all glitchy and broken and nothing worked.

So, what's the best way to give custom attributes to controls? Is there a property I'm missing? I know there's the "identifier" property, but I don't want my custom attributes to be unique per control. Probably best for this purpose would be a dictionary, so I can use as many attributes as I wish.

EDIT: is it okay if I click on the contained cells (NSCell-based) and set representedObject?

Last edited by printz; May 4, 2013 at 04:09 AM.
printz is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Custom Camera Interface akbapu-14 iPhone/iPad Programming 1 Feb 15, 2014 12:38 PM
iPhone: How to add custom icons , Hgjybrandon123 Jailbreaks and iOS Hacks 3 Jan 11, 2014 08:05 PM
Resolved: How can I add customized attributes to my files? AppleCat Mac Programming 2 Sep 8, 2013 08:56 AM
PDF Attributes simple tool for editing PDF attributes Alex Aperio Lux Mac Applications and Mac App Store 0 Apr 8, 2013 04:17 PM

Forum Jump

All times are GMT -5. The time now is 05:22 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC