Questions tagged [cocoa-design-patterns]

Use this tag for questions about design patterns that apply specifically to using the Cocoa and Cocoa-Touch frameworks used in MacOS and iOS development. Examples of such design patterns include, but are not limited to, 'MVC' (model-view-controller), 'delegation', 'observer', 'singleton', 'responder chain', and more. Some of these are well-known patterns but may be used in Cocoa and Cocoa-Touch in more specialised ways.

174 questions
0
votes
1 answer

Cocoa MVC restrictions

In Cocoa MVC adoption, View knows nothing about the Model, which illustrated in this diagram: But consider this example: I have Item class in my model and I want visual representation for it. Most obvious for me is ItemView class, which is…
0
votes
1 answer

What is the best design pattern to distribute a property change to subviews?

Suppose I have a setting in NSuserdefaults that should affect a property for a lot (but not all) UIView objects, for example the font size. The setting can also be changed from a 'main' viewcontroller and should be 'distributed' to UILabel objects…
Bjinse
  • 1,339
  • 12
  • 25
0
votes
1 answer

Looking to refactor objective-c UIViewController iPad/iPhone

I've inherited a long term maintenance code base that has two radically different iPhone and iPad views. This has created one large UIViewController class that has ballooned to over 1k lines of code, is a mashup of ISIPAD statements, private vars,…
Sandoze
  • 472
  • 2
  • 9
0
votes
1 answer

Picker's for mac

Do we have UIAlert/Date picker kind of controls for cocoa mac desktop applications? (These controls are visually appealing)
sach
  • 1,069
  • 4
  • 15
  • 29
0
votes
1 answer

NSAlert showing misplaced buttons

I've a multithreaded OSX application that is showing an NSAlert window. Most of the cases the UI seems fine but sometimes it breaks down the UI by misplacing the button which looks very ugly. As i can't block the main thread and don't want to show…
Prince
  • 21
  • 1
  • 2
-1
votes
6 answers

How to add (id) sender to the following -(IBAction)?

How do you add a (id) sender to the following code? - (IBAction) gobutton: (UIButton *) button5 { Everything I try fails, any help would be appreciated. Thanks. EDIT: I need to keep the (UIButton *) button 5 reference in the (IBAction)
0SX
  • 1,252
  • 6
  • 24
  • 47
-1
votes
3 answers

How to add a slider to move downward in view?

I am new to iOS programming, so I hope its not a stupid question to ask. I have to add ten different buttons in my view programmatically. I know how to add buttons programmatically, but my buttons won't fit within the view so some of them have to be…
-2
votes
1 answer

Can anyone make the code in Cocoa Design Patterns by Buck and Yacktman work?

I am working through the book Cocoa Design Patterns by Buck and Yacktman and it seems their sample code is out of date. When I try to run it, xcode says: "The run destination My Mac 64-bit is not valid for Running the scheme." Is there an easy way…
Adam S.
  • 306
  • 2
  • 11
-3
votes
2 answers

object communication when object is not kvc compliant in Swift

I want to create a custom view that display it when an action occurs (like changed property) on another object (subclass of UIControl) My approach was it create a protocol whose UIControl objects can conform create my custom view in which I can…
1 2 3
11
12