Hello all,
I've run into an issue a few times and I'd like to see if someone has a
good design suggestion to address my problem.
Consider an iPad or iPhone application based on a UINavigationController -
that displays a 'menu' button in the UINavigationBar. The navbar renders
UIBarButtonItems
You can add a category on UIViewController, do some detection and swizzle
-[UIViewController viewWillAppear:] method.
On Apr 14, 2014, at 5:55, Luther Baker lutherba...@gmail.com wrote:
Hello all,
I've run into an issue a few times and I'd like to see if someone has a
good design
Why not just make a common UIViewController subclass that manages the global
menu button, and then subclass that class for each of the controllers that live
on your navigation stack? If it contains the ivar for the UINavigationItem
(marked @protected) instead of having that ivar in each of the
I want to display a window as a modal dialog.
Should I use just a Window Controller or also define another class that handles
the window contents.
-koko___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or
That is what I thought but just wanted too verify … thanks.
-koko
On Nov 26, 2011, at 12:28 PM, Dave Fernandes wrote:
You can just subclass NSWindowController and make that subclass the File's
Owner.
Sent from my iPhone
On 2011-11-26, at 2:14 PM, koko k...@highrolls.net wrote:
I
Hi,
I'm using the following piece of code in several places to get a pointer to the
active windowController in my document-based application:
NSDocument *currentDocument = [[NSDocumentController
sharedDocumentController] currentDocument];
if (!currentDocument)
return;
One way of dealing with this is to make the method part of an informal protocol
and check before calling it. Details are here:
http://cocoadevcentral.com/articles/75.php
--
David Kennedy (http://www.zenopolis.com)
On 21 Oct 2011, at 08:39, Luc Van Bogaert wrote:
Hi,
I'm using the
On Thu, Jul 14, 2011 at 1:25 AM, Roland King r...@rols.org wrote:
Custom button with your own graphic tick/cross is probably what I'd use for
this. That's easy to do and fits pretty well with the ios look and feel.
Either have two buttons and use them as radio buttons (unselect one when
you
On 14 Jul 2011, at 06:05, John Tsombakos wrote:
Hi,
Just getting more into iOS development, and am deciding on what to do for an
app. One app is a competition scoring application, where the judges would
use the app to calculate and score a game. The scores would are derived from
a series
On Thu, Jul 14, 2011 at 8:14 AM, Thomas Davie tom.da...@gmail.com wrote:
Along with various other people, I have a custom UISwitch that does exactly
what you require, it's available here http://whataboutapp.co.uk/
Tom Davie
That looks exactly what I would want! Thanks!
On Thu, Jul 14, 2011 at 9:26 AM, John Tsombakos joh...@charter.net wrote:
On Thu, Jul 14, 2011 at 8:14 AM, Thomas Davie tom.da...@gmail.com wrote:
Along with various other people, I have a custom UISwitch that does
exactly what you require, it's available here http://whataboutapp.co.uk/
Hi,
Just getting more into iOS development, and am deciding on what to do for an
app. One app is a competition scoring application, where the judges would
use the app to calculate and score a game. The scores would are derived from
a series of challenges, each worth a set number of points.
Each
Custom button with your own graphic tick/cross is probably what I'd use for
this. That's easy to do and fits pretty well with the ios look and feel. Either
have two buttons and use them as radio buttons (unselect one when you hit the
other) or if perhaps try one button which switches states
thank you very much for your answers.
2011/3/23 Graham Cox graham@bigpond.com
On 23/03/2011, at 11:58 AM, Quincey Morris wrote:
1b. The property is a to-many relationship.
If #1a, then the return value should be unchangeable, in the sense that
it should never change after being
On Mar 22, 2011, at 16:53, Graham Cox wrote:
That's because a) NSMutableArray IS a NSArray, and b) your method has told
its clients it is returning an NSArray, so the client has no right to go any
further than the methods of NSArray with that object, that is, it cannot make
use of
On 23/03/2011, at 11:58 AM, Quincey Morris wrote:
1b. The property is a to-many relationship.
If #1a, then the return value should be unchangeable, in the sense that it
should never change after being returned (regardless of whether the returned
object is of a mutable class or not). That
On 11/2/09 12:58 PM, Ben Trumbull said:
This doesn't really have anything to do with Core Data. However, for
NSManagedObject, Core Data already provides the change coalescing and
NSNotifications for you. You can respond within
NSManagedObjectContextObjectsDidChangeNotification instead.
So I
What is considered best practice when it comes to mutating many
properties of a managed object, specifically with regard to KVO
observers getting notified before all mutations are finished?
This is a problem intrinsic to the design of KVO. KVO is all about fine
grained per property
Graham,
Thanks for the detailed reply!
I'd say you're going down the wrong path there.
Agreed, hence my post. :)
Set each property individually. Yes, it will trigger a notification
for each one - doesn't or shouldn't matter, and unless you can show it
causes a performance problem, shouldn't be
On 11/2/09 12:58 PM, Ben Trumbull said:
What is considered best practice when it comes to mutating many
properties of a managed object, specifically with regard to KVO
observers getting notified before all mutations are finished?
This is a problem intrinsic to the design of KVO. KVO is all
If your issue is that drawing or recalculation is occurring too
frequently after KVO changes, you can consider coalescing and deferring
the observers' actions instead of performing them synchronously. This
can be valuable even for less complex KVO issues.
You could also refactor the 3
Hi all,
What is considered best practice when it comes to mutating many
properties of a managed object, specifically with regard to KVO
observers getting notified before all mutations are finished?
Let's say I have an Rectangle object. It has properties: colour, width,
height. Imagine some
On 31/10/2009, at 9:01 AM, Sean McBride wrote:
Hi all,
What is considered best practice when it comes to mutating many
properties of a managed object, specifically with regard to KVO
observers getting notified before all mutations are finished?
In situations like these I personally tend to
Hi Sean,
I'd say you're going down the wrong path there.
Set each property individually. Yes, it will trigger a notification
for each one - doesn't or shouldn't matter, and unless you can show it
causes a performance problem, shouldn't be a cause for worry on that
score. It won't cause
Hello everyone.
I have a DVR (digital video recorder) program I wrote in Windows that I
want to re-write on the Mac. And I wanted to get some ideas about how
best to use Cocoa objects to make this program work as I'm still
relatively new to Cocoa programming.
The application has 2 modes,
On Sep 4, 2009, at 4:55 PM, Marek Kozubal wrote:
Another question related to this is what API set provides the
fastest disk IO under Mac OS X? On the windows side I used
FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH flags with the
ReadFile/WriteFile API.
The fastest will be the
I have a question, or rather, I'm looking for advice, on the design of
an application. Essentially I'm wanting to write a labbook-type
application. My plan was to use core-data for the model. In the model
will be an Entry entity. Each entry will have a one-to-one
relationship to a Content entity.
On Aug 29, 2009, at 5:53 PM, Ben Trumbull trumb...@apple.com wrote:
Encoding your data this way is pushing the boundaries of violating
MVC patterns by archiving UI information (NSTextView drawing
information) into your model (database). That obviously doesn't
work if the platform doesn't
Dear list,
I have a question, or rather, I'm looking for advice, on the design of
an application. Essentially I'm wanting to write a labbook-type
application. My plan was to use core-data for the model. In the model
will be an Entry entity. Each entry will have a one-to-one
relationship
On Aug 28, 2009, at 8:37 AM, Martin Hewitson wrote:
Dear list,
I have a question, or rather, I'm looking for advice, on the design
of an application. Essentially I'm wanting to write a labbook-type
application. My plan was to use core-data for the model. In the
model will be an Entry
Fair enough. I guess what I'm wondering then is how do I handle the
following case. I have several loosely coupled properties which can
read somewhat like this.
(ProjectInstall *)projectInstall {
return [ProjectInstallController projectInstallWithProjectId:projectId];
}
And in some cases
On Aug 6, 2009, at 07:46, Kaelten wrote:
I guess what I'm wondering then is how do I handle the
following case. I have several loosely coupled properties which can
read somewhat like this.
(ProjectInstall *)projectInstall {
return [ProjectInstallController
On Aug 6, 2009, at 12:29 PM, Quincey Morris wrote:
Finally, the question of whether 'projectInstall' sometimes returns
nil is irrelevant. That has nothing to do with the compliance of the
Project object.
Except, check out Bug Fix in KVO's Dependency Mechanism in the
Leopard Foundation
I have an application I'm working on where I'm using mainly Bindings
for communicating with the UI, but I find myself in situations where
I'm not getting all the data updates to the UI.
These lack of updates seem to stem either from dependent keys, loose
coupling between objects, to-many
On Aug 4, 2009, at 11:35, Kaelten wrote:
I have an application I'm working on where I'm using mainly Bindings
for communicating with the UI, but I find myself in situations where
I'm not getting all the data updates to the UI.
These lack of updates seem to stem either from dependent keys,
, separately from search.
izidor
On 21.3.2009, at 11:24, David Yamartino wrote:
Hi All,
I have a general design question. I'm going through the latest
Hillegass and
Kochan programming books for the purpose of writing a simple search
app. I
think I've figured out a way to do
a general design question. I'm going through the latest Hillegass
and
Kochan programming books for the purpose of writing a simple search app. I
think I've figured out a way to do this, but having no experience in
programming, I have no idea if my approach is good or bad. I'd rather not
take the stupid
Then again, I guess I could use Spotlight to locate the proper files, and
then focus on them for finding the position of the words and then getting
the words around them for the snippets, etc.
Exactly. However, for the amount of data you're talking about, just loading
it up searching it is
Yes, thank you.
So that's how I'll proceed.
David
--
On Tue, Mar 24, 2009 at 3:18 AM, Scott Ribe scott_r...@killerbytes.comwrote:
Then again, I guess I could use Spotlight to locate the proper files, and
Hi All,
I have a general design question. I'm going through the latest Hillegass and
Kochan programming books for the purpose of writing a simple search app. I
think I've figured out a way to do this, but having no experience in
programming, I have no idea if my approach is good or bad. I'd
Hi All,
I need to display huge number of elements in NSView (1000-2000).
These elements are generally made of high resolution image files with
some fancy drawing around them. These elements may vary from size 300
X 270 to 4280 X 3500.
First I made use of NSView's for elements, I abandoned
On 10/03/2009, at 7:39 PM, rajesh wrote:
Is there any other way of approach, or should I be making use of one
of the ways I mentioned ?
Of course - just define a custom object that contains or manages each
piece of content and draw them in one view. This is the classic
approach and is
On Mar 10, 2009, at 1:39 AM, rajesh wrote:
I need to display huge number of elements in NSView (1000-2000).
These elements are generally made of high resolution image files
with some fancy drawing around them. These elements may vary from
size 300 X 270 to 4280 X 3500.
First I made use
On Feb 12, 2009, at 9:50 AM, David Blanton wrote:
Do I understand correctly that if a layer with explicit animations
is hidden the animation is still running?
Yes, animations always run, regardless of the hidden state of a layer
(hidden is just another render attribute).
--
David Duncan
So besides hiding a layer I should also removeAnimationForKey:
Thanks!
On Feb 12, 2009, at 11:16 AM, David Duncan wrote:
On Feb 12, 2009, at 9:50 AM, David Blanton wrote:
Do I understand correctly that if a layer with explicit animations
is hidden the animation is still running?
Yes,
I'm just starting to delve into the first responder chain to handle
menu actions.
My conceptual understanding of MVC is that the controller is the one
who determines what to do with actions. When someone wants to do
something the controller is told by a control in the view, it updates
the model
Cocoa Design Patterns Chapter 29, Controllers, contains an MVC
solution to exactly the problem Oleg Krupnov describes. The chapter
presents a relatively simple MVC MYShapeDraw application. The chapter
leads the reader through the step by step process of re-inventing
NSArrayController
Sorry. When I posted about the problem Oleg Krupnov describes, I
wasn't caught up on my reading of the list. The VC MYShapeDraw
application I describe is a drawing application and not related to
image thumbnail caching. Of course, the pattern is general and
applicable to image thumbnail
Parts of your first question remind me of a situation that I had. Erik Buck
gave me some great advice and part of it was the following:
If you are worried about adding drawing code to a Model object, add the
drawing code in a category of the model object* and maintain the category
Yes, you are correct. I am looking not to break MVC and also get the
correct implementation of binding in a custom view
Just an example: I had a graphic application that drawed some inserted
shapes. The shape itself is a part of the model, the color of the shape,
too. But when the user selects
Okay, I – hopefully – understand you now:
You have a view with some (model) objects displayed.
There is another view (potentially or really?) that can display these
objects, too
The additional attributes are specific for each displayed object and
each view?
Correct? (There is a german
On Aug 28, 2008, at 11:06 AM, Oleg Krupnov wrote:
In other words, I need a way to associate additional
custom-view-specific properties with model object, without adding them
as transitive properties to the model. What is the best way to do
this? Or maybe your point is that this is a bad idea
I think there are times when it's appropriate to have wrapper objects - that
are view related - for your model objects. In an image browser, it's likely
that there is a thumbnail object that draws image objects.
Yeah, maybe view-related wrapper objects for model objects is the right term.
In
On 28 Aug 2008, at 6:15 pm, Oleg Krupnov wrote:
I have only one problem with this approach: As I mentioned before, I
need to add custom-view specific instance variables (states) to the
model object's category. The Objective-C categories do not allow
adding instance variables, only methods
I
On 28 Aug 2008, at 8:26 pm, Oleg Krupnov wrote:
In your image browser example, this problem sounds as follows: where
to store the cached thumbnail images, to avoid re-creating them anew
in each drawRect call? Also, if a thumbnail is in process of dragging
inside the custom view, where to save
On Aug 28, 2008, at 12:26 PM, Oleg Krupnov wrote:
I think there are times when it's appropriate to have wrapper
objects - that
are view related - for your model objects. In an image browser,
it's likely
that there is a thumbnail object that draws image objects.
Yeah, maybe view-related
Grahaam Cox wrote on 2008-08-28 13:11:47:
Regarding the above though, if this is similar to your situation -
what's really wrong with model objects caching a thumbnail? Being a
slave to MVC is going to lead to suboptimal solutions just as ignoring
MVC altogether is going to be. The
Thanks, that mostly answers my question, finally. And the short answer
is No :). There is no standard Cocoa way of doing this and it's up
to me how to implement it. I just wanted to make sure I was not
reinventing the wheel.
You are correct in suspecting me in a kind of MVC purism (typical for
a
I am building a custom view that can display and edit some polymorphic
objects. Furthermore, the objects can be composite, i.e. contain child
objects hierarchically.
Now I want to bind this custom view to the model through a controller
(NSTreeController in my case).
In the examples I have seen
I need to make the design decision regarding how the model and the
views will be kept in sync with each other. Namely:
- I can use key-value coding and observing (KVC and KVO)
- I can use bindings (not sure if it's really different from the KVC/KVO)
- I can write the glue code myself
The concept
Am Do,21.08.2008 um 08:58 schrieb Oleg Krupnov:
I need to make the design decision regarding how the model and the
views will be kept in sync with each other. Namely:
- I can use key-value coding and observing (KVC and KVO)
- I can use bindings (not sure if it's really different from the KVC/
I suspect that it could be way easier, when a property's value
changes, to just explicitly send a concise and clearly named message
to the subscribed objects,
This is, what is done. The name of the message is
-observeValueForKeyPath:ofObject:change:context:
Then how is it better than manual
Am Do,21.08.2008 um 15:22 schrieb Oleg Krupnov:
I suspect that it could be way easier, when a property's value
changes, to just explicitly send a concise and clearly named message
to the subscribed objects,
This is, what is done. The name of the message is
Thanks Amin for responding.
You are correct that there's no need to reinvent the wheel, and that's
exactly what I'd like to avoid, that's why I am now re-reading about
KVC/KVO and reconsidering it.
So, does everybody really always use KVC/KVO for implementing MVC, in
all projects? Is this the
Am Do,21.08.2008 um 16:41 schrieb Oleg Krupnov:
Thanks Amin for responding.
You are correct that there's no need to reinvent the wheel, and that's
exactly what I'd like to avoid, that's why I am now re-reading about
KVC/KVO and reconsidering it.
So, does everybody really always use KVC/KVO
Oleg,
by all means, go ahead with what you started and spend more time
learning about KVC/KVO.
Yes, this is used in many many projects and I personally would really
miss it if it wouldn’t be there. Actually, as you described yourself,
if it wouldn’t be there, you’d had to brew something
Am Do,21.08.2008 um 17:03 schrieb Oleg Krupnov:
Amin,
It is true that I am new to Cocoa, and although I find the
documentation really great and engaging, I have sort of difficulty
figuring out what technology is newer/more powerful/built on top of/
other technology.
In particular, would you
I have some quibbles...
On Aug 21, 2008, at 12:54 PM, Erik Buck wrote:
So, in summary, the whole point of KVC is to standardize the way an
object’s properties are accessed regardless of how they are stored.
Well, the real point, to my mind, is to increase the dynamism of
property access.
Remember that NeXT and Apple didn't just invent KVC, KVO, and Bindings
out of thin air for no better reason than they were enamored of the
idea.
There was a substantial history of NeXTStep/OpenStep/Cocoa programs
written. The developers at NeXT and then Apple recognized that there
was a
On Aug 21, 2008, at 7:12 PM, Ken Thomases wrote:
I have some quibbles...
On Aug 21, 2008, at 12:54 PM, Erik Buck wrote:
So, in summary, the whole point of KVC is to standardize the way an
object’s properties are accessed regardless of how they are stored.
Well, the real point, to my
On Aug 21, 2008, at 7:09 PM, Erik Buck wrote:
On Aug 21, 2008, at 7:12 PM, Ken Thomases wrote:
On Aug 21, 2008, at 12:54 PM, Erik Buck wrote:
KVC also provides support (hooks) for change management so that
any change to a property can have application defined side effects
like
On 22 Aug 2008, at 1:03 am, Oleg Krupnov wrote:
4) Anything else I may have overlooked?
I've read through this thread and it's very interesting.
But one thing that has been overlooked - common or garden
notifications. If all you want is to pick up a change in an object a
notification
Ken,
Thanks for your explanation of the development of KVC, KVO, and
Bindings.
As a geezer who spent most of his career coding in assembler on IBM
mainframes beginning in the late 60's, it is still sometimes difficult
not having total control over my code.
KVC, KVO, and Bindings is one of
So, does everybody really always use KVC/KVO for implementing MVC, in
all projects? Is this the recommended best practice?
From code written after 10.2, yeah, pretty much. Coupled with the
tools support in Interface Builder and the AppKit support with Cocoa
Bindings, it's really not worth
On Thu, Aug 21, 2008 at 10:27 PM, Graham Cox [EMAIL PROTECTED] wrote:
But one thing that has been overlooked - common or garden notifications. If
all you want is to pick up a change in an object a notification is a simple
way to do it without writing your own messaging system. It's less
On Fri, Aug 22, 2008 at 3:59 PM, Kyle Sluder
[EMAIL PROTECTED] wrote:
@implementation ToolBar
{
-(id) init
{
[[[NSNotificationCenter] defaultCenter] addObserver:self
selector:@selector(splitViewResized:) object:mySplitView];
}
-(void)dealloc
{
[[NSNotificationCenter]
On 22 Aug 2008, at 2:22 pm, Phil wrote:
Why use NSNotifications when there's already
perfectly good notification mechanism?
Indeed, but notifications have been around a lot longer than KVO, so
there are still plenty of places in Cocoa that notifications are used
for legacy reasons.
On Mon, Jul 21, 2008 at 4:05 AM, James W. Walker [EMAIL PROTECTED] wrote:
I have these windows, each of which has a table displaying data from an
array of dictionaries. The data is never stored on disk, so I don't think
of these windows as documents.
In addition to what Jens said: If the
On Jul 20, 2008, at 10:24 PM, Jens Alfke wrote:
On 20 Jul '08, at 8:05 PM, James W. Walker wrote:
Since there is a window (which has a title that depends on the
data) I thought I should use a subclass of NSWindowController. On
the other hand, there is an array being displayed in a table,
I have these windows, each of which has a table displaying data from
an array of dictionaries. The data is never stored on disk, so I
don't think of these windows as documents. Since there is a window
(which has a title that depends on the data) I thought I should use a
subclass of
On 20 Jul '08, at 8:05 PM, James W. Walker wrote:
Since there is a window (which has a title that depends on the data)
I thought I should use a subclass of NSWindowController. On the
other hand, there is an array being displayed in a table, and I
gather that's easier to set up using
Hi all,
As a developer entering the cocoa world for the first time one of the things I
am finding difficult is how to start structuring an application, I mean what
classes should I create to make an OK application design.
I have a simple application I am working on at the moment, and am hoping
I'd agree with what I.S. said, make sure you read up on and run
through some tutorials for coding a table and its data source by
hand. Aaron Hillegass does a great job of this in Cocoa Programming
for Mac OS X. As a Cocoa newbie this is a great book to hit the
ground running. It assumes
Ken Thomases wrote:
How about a dictionary whose keys are NSValues representing the
objects? For each object, the value from the dictionary would be an
NSMutableArray whose elements are the key paths being observed on that
object.
// ...
NSValue* objectKey = [NSValue
On Jul 11, 2008, at 2:45 AM, Patrick Mau wrote:
Do you think that observing lots of objects with lots
of keypaths is a good idea anyway?
Honestly, I've forgotten the original design issues you're considering.
If you need to observe lots of objects and key paths to achieve your
purposes,
On Jul 10, 2008, at 4:55 PM, Patrick Mau wrote:
I'd like to show you one ugly detail. I put all observed objects,
including their keyPath in a local NSDictionary, because I have to
remove the observers on deletion of a table row. The 'observeObject'
looks like that:
-
Hallo everyone
I would appreciate if someone wants to comment on my conceptual design
question:
I have developed a custom NSView displaying a pie chart. The data is
an NSMutableArray containing NSMutableDictionary instances for the pie
segments (a standard NSArrayController instance).
Each
Where would you observe changes to data?
I think you should worry about one thing at a time (ie, leave the
animation part for another day and concentrate on your bindings
machinery first). Check out this page:
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
Great examples of
Check out this page:
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
I should also mention that you should approach these examples like this:
1 - Read the Cocoa Bindings documentation (including all the Key Value
Coding / Key Value Observing related documentation).
2 - Examine
I. Savant wrote:
Check out this page:
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
I should also mention that you should approach these examples like this:
1 - Read the Cocoa Bindings documentation (including all the Key Value
Coding / Key Value Observing related
XMPP protocol stack, so feel free to
contact me directly.
From: vance [EMAIL PROTECTED]
Subject: MVC Design Question
If you would design an IM client using MVC, where would the connection
object be?
___
Cocoa-dev mailing list (Cocoa-dev
91 matches
Mail list logo