Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hjalmarsn

macrumors newbie
Original poster
Mar 10, 2011
1
0
Hello!
Say that I have this view called "MyView" located in my main window.
And I have these three dropdowns called "Shadow", "Color" and "Border" also located in my main window.

Whenever I change one of these dropdowns I want the view to update with the selected property!
How do I do this? I'm currently just able to draw a square in the view :(

Please help me out on this one!

Thank you!
 
(1) Create a new Objective-C class, e.g., AppController.
(2) Give it an IBOutlet for the view. Give it an IBAction instance method, e.g., handleDropdown.
(3) Instanciate your class in the nib (or xib) file, by dragging an object from the palette into the document (the little window with file's owner and first responder, not the window containing your view) and setting its type to AppController (in the inspector).
(4) Have the outlet point to your view, by right-clicking on AppController and dragging to the view.
(5) Set your new instance of AppController as the target of the dropdown, by right-clicking on the dropdown and dragging to AppController.
(6) In your handleDropdown method, query the dropdown (= sender) for its state and change the view as desired, finishing with [view setNeedsUpdate:YES]. You might also put an NSLog() to see if the method gets called.
(7) Build and run.
And by all means, get yourself a good book on Cocoa programming.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.