On Feb 2, 2011, at 9:22 PM, Omar Hagopian wrote:
Hi there!
I am planning to implement a component similar to the iphone's photo album..
I guess that using uviews will make the component to have a bad performace ,
I mean scrolling slow and all of the stuff ... so which way should I take?
Fair enough.
On Jan 13, 2011, at 1:19 PM, Uli Kusterer wrote:
On Jan 13, 2011, at 1:27 AM, Erik Buck wrote:
Class or instance method makes no difference in this case with regard to
polymorphism.
It does. He's only passing the two instance variables to the class method.
And, being
Class or instance method makes no difference in this case with regard to
polymorphism.
On Jan 12, 2011, at 4:51 PM, Gordon Apple wrote:
What I would do use a class method and pass the two arrays as parameters.
On 1/12/11 2:03 PM, cocoa-dev-requ...@lists.apple.com
Each time -drawRect: is called, the rect parameter is a dirty rectangle
calculated by the frameworks to be the smallest area that needs to be redraw.
With your implementation, you are probably filling several small sub-rectangles
of the view's bounds with white and then stroking lines in only
Enabling empty selection in IB should do the trick. You can also control
selection programmatically with the delegate.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/Reference/Reference.html
Out of curiosity: Why not allow selection? Users
NSTextField doesn't display or edit text at all. It uses an instance of
NSTextView calle dthe filed editor to provide all text dispay and editing.
So you are right: NSTextFiled cannot do anythingthat NSTextView can't because
NSTextField uses NSTextView.
NSTextView is a large and heavy weight
Change Filed to Field where appropriate. Grumble...auto-correct...grumble.
--- On Thu, 11/11/10, Erik Buck erik.b...@sbcglobal.net wrote:
From: Erik Buck erik.b...@sbcglobal.net
Subject: Re: NSTextView vs NSTextField
To: Cocoa Dev cocoa-dev@lists.apple.com, Eric Gorr
mail...@ericgorr.net
Of interest to Cocoa and OpenGL ES programmers:
OpenGL ES for iOS: All of the Important Parts
Addison-Wesley Professional (Developer's Library) [Paperback]
Expected publication November 29, 2010.
http://cocoadesignpatterns.squarespace.com/updates/
This book contains an introduction to modern
On Sep 19, 2010, at 12:36 PM, k...@highrolls.net wrote:
Am I on the right track or is there something even easier?
IMHO, No.
Please explain why you would subclass NSImage to accomplish any of your goals.
I suspect that the effort of making that explanation will be insightful. Hint:
http://www.informit.com/articles/article.aspx?p=1211756seqNum=5
http://lapcatsoftware.com/blog/?s=without+a+nib
http://lapcatsoftware.com/blog/2007/05/16/working-without-a-nib-part-1/
http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open-recent-menu/
http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html
See NSResponder or, in UIKit, UIResponder
I would add that any graph of objects that implements the NSCoding protocol
can also be trivially copied. Interface Builder encodes and decodes object
graphs when saving the xib/nib files and also when entering test interface mode.
As a blatant plug:
See Cocoa Design Patterns ISBN:
You will find a similar connected lines to inputs and outputs interface in
Quartz Composer. I don't think Apple has provided source code for either
approach, but it is not that hard.
One of my company's products contained a similar interface in NeXTstep
(proto-Cocoa) in ~1996. We
use blocks and gcd, or use a proxy
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSProxy_Class/Reference/Reference.html
A proxy can forward all invocations to the main thread. Create a subclass of
NSProxy. Implement
–
You have too many design options on the table. Try some of them in
mini-prototypes to see how well they work and then drop some of the ideas.
I have used Core Data to store Model data for 2D and 3D drawing/visualization
applications. My approach was to use the Core Data designer to specify
I have never seen the specific problem reported, but I have some suggestions:
1) Are you using a retained or non-retain window as opposed to a buffered
window? You want a buffered window.
2) Is the view layer backed? I don't know ifthat could cause the problem, but
I is a path to investigate.
I had a shrinkwraped OPENSTEP Enterprise 4.2 CD from March 1997 in my file
cabinet, so I just installed it on a crap 1.83GHz Core 2 (not-duo) running
Windows XP SP3.
- OPENSTEP Enterprise 4.2 installes from CD in less than 1 minute (not counting
the neccessary reboot that follows)
It is
For comparison, I installed MS Visual Studio 2010 Express Edition C++ on the
same machine. It takes 14 minutes not counting the 2 reboots required. The
first time Visual Studio 2010 C++ starts, it takes more than one minute to get
past the splash screen.
The user interface MS Visual Studio
Don Yacktman and I have received feedback that Cocoa Design Patterns should
have more coverage of multi-threaded and distributed design patterns. Some
readers have asked for comparison and contrast between Cocoa design patterns
and patterns in .Net or other frameworks. Is it worthwhile to
On Feb 28, 2010, at 10:49 PM, David Rowland wrote:
On Feb 28, 2010, at 7:24 PM, Erik Buck wrote:
I disagree. I have written very low latency device drivers in Objective-C.
Why do you think Objective-C has too much latency for audio? When
properly used, Objective-C programs
Never call -drawRect: directly. It is a Template Methods i.e. Don't call us;
we'll call you. (Note: there might be some exceptions that prove the rule.)
As of Leopard and possibly sooner, individual dirty rectangles are available
through the - getRectsBeingDrawn:count: method if you use it
send [[textField window] makeFirstResponder:[textField window]]; to finish any
editing in progress in textField or any other text field within the window.
or see Forcing the End of Editing at
For a variety of reasons, I use Core Data with OpenGL all of the time. One of
my presentations this weekend at Voices That Matter: iPhone Developers
Conference uses a Core Data application with two different Views as an example
of the MVC design pattern. One View presents information about
Do you have some objection to [myTextFiled setEnabled:YES]; and [myTextFiled
setEnabled:NO]; ?Perhaps you prefer myTextFile.enabled = NO; ?
UITextField is a subclass of UIControl which means that all of UIControls
properties and methods are available in UITextField.
Remember that all controls are views. Overlapping sibling controls
have a definite user interface smell.
Assuming that the overlapping controls are visible at the same time,
the appearance is likely to be unsatisfactory. Issues of mouse based
picking arise. Which control will be hit by
Don't overlap sibling views. Even though it works reliably now, it is still a
poor practice for controls and has a definite user interface smell.
If you must use the same area of the user interface for different purposes at
different times, consider using a tab view with no visible tabs and
The -bestRepresentationFirDrevice: method is doing nothing better than
[anImage size] would do for you.
You are not doing anything useful with rotatedSize in your code.
Your test for if (degrees == 180.0) is completely pointless. If you
were going to do it anyway, you should be looking for
- Posix message queues are a finite kernal resource that is not freed when
processes terminate incorrectly.
- Posix semaphores are a finite kernal resource that is not freed when
processes terminate incorrectly.
- MACH IPC message queues are a finite kernal resource that is not freed when
http://developer.apple.com/qa/qa2001/qa1133.html answers your question
perfectly.
That was the first hit when I typed console user into the search field at
developer.apple.com
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post
NSLog(@%@, [scrollView documentView]); //outputs (null)
What does NSLog(@%@, scrollView ); tell you ?
// the following is a memory leak if you are not using garbage collection
[scrollView setDocumentView:[[NSView alloc] initWithFrame:NSMakeRect(0, 0,
500, 500)]];
Try
[scrollView
I didn't see any actual question. I think you also need to post more code if
you want anything better than wild guesses about what you are doing.
Start here:
http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.html
I assume you are using -
Didn't there used to be a FAQ list for Cocoa-Dev?
Several people recently asked me for links to introductory Cocoa and
Cocoa Touch information. I pointed iPhone folks to http://developer.apple.com/iphone/library/navigation/GettingStarted.html
and the others to
Sorry. Right after I posted, I found http://www.cocoadev.com/index.pl?FAQs
On Jul 21, 2009, at 6:07 PM, Erik Buck wrote:
Didn't there used to be a FAQ list for Cocoa-Dev?
Several people recently asked me for links to introductory Cocoa and
Cocoa Touch information. I pointed iPhone folks
I doubt Apple is going to port Cocoa/CoreData to Windows just for
iTunes database�
Not that I disagree, but what makes you think Cocoa doesn't already
work on Windows? Openstep worked on Windows before it worked on Mac
OS X. Cocoa is derived from Openstep.
Project Builder (the
I have re-written the Accessors chapter of Cocoa Design Patterns several
times because of controversy over whether accessors should, can, must or must
not be used in initializers and dealloc. The bottom line is that accessors are
the only way to set synthesized instance variables to nil in the
and -dealloc.
Remind me again why I shouldn't ?
--- On Wed, 7/8/09, Bill Bumgarner b...@mac.com wrote:
From: Bill Bumgarner b...@mac.com
Subject: Re: Clarification on accessors? (was: Yet another memory management
question)
To: Sean McBride s...@rogue-research.com
Cc: Erik Buck erik.b
:
On 19/06/2009, at 3:59 AM, Erik Buck wrote:
use
[[myBox subviews] makeObjectPerformSelector:@selector(setEnabled:)
withObject:NO];
or similar.
Are you certain that works? 'NO' isn't an object, so I didn't think
you could use -makeObjectsPerformSelector:withObject: in this
fashion
See the - (void)setRepresentedObject:(id)anObject method of NSCell. You can
set a string or dictionary and the represented object and retrieve it via
-representedObject.
You can also instantiate an array and add objects to the array within IB. Then
you only need an outlet instance variable
Only a little bit of math is neccessary to use affine transforms. A lot of
math is needed for general 3D programming, but let's ignore that for now.
My third grader was tought about associative and communitive math operstions.
Some matrix operations are associative and some are communitive.
My third grader was taught about associative and commutative math
operations. Some matrix operations are associative and some are
commutative. That's why the order of operations matters.
Just in case: I didn't mean to imply that even third graders should understand
matrix math. It
I have a pet theory about why IB is totally obvious at the first encounter for
some people and prompts other people to write about ...5 failed attempts (over
the
years) to learn IB...
Before I share my theory and bias the responses, I hereby ask those readers
who resisted IB for a long time
http://developer.apple.com/samplecode/GeekGameBoard/
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Set the frame of the NSMatrix.
Use -sizeToFit.
- or- create and size the matrix the way you want it in IB; save it as
a stand alone view; load it; add it as a subview, and add/remove cells
to suit your needs.
___
Cocoa-dev mailing list
Announced publicly today:
Digital Asset Exchange support.
Collada Digital Asset Exchange (.dae) files are a popular way to share
3D models and scenes between applications. Preview now displays these
files with OpenGL-powered 3D graphics, so you can zoom and rotate
around a 3D scene and play
I have not used any of these VRML resources, but some may be helpful.
I think that Blender can output VRML. SketchUp definitely can.
http://www.apple.com/downloads/macosx/imaging_3d/freewrlvrmlx3dviewer.html
http://sketchup.google.com/support/bin/answer.py?hl=enanswer=114420
Don't ever write either of the following lines:
NSString *string1 = [NSString stringWithFormat:@myFirstString];
NSString *string2 = [[NSString alloc]
initWithFormat:@mySecondString];
the WithFormat methods parse the argument string. If your argument
string contains any '%' characters
Is it a good idea to split all those classes into categories for
writing, reading and testing? For example, Database (Writing),
Database(Reading), Database(Testing) and so on? Or is it a silly thing
to do for some reason?
Maybe ? What trade-offs have you considered ? On reason to use
Do you have a question ? Why don't you just create a subview with
various controls in IB. Then, in code, make a copy of that object and
in turn make modifications to some of the objects in that view. For
example, set a text field to a value. Then, add it to a super view.
You seem to
The whole debate about mutable and immutable classes, the inheritance
hierarchy, what it means to return a pointer to a supposedly immutable object,
what it means to store a pointer to a supposedly immutable object, the
substitutability principle of object oriented programming, whether
The full content of the forthcoming book, Cocoa Design Patterns, is now
available as Rough-Cut on-line:
http://my.safaribooksonline.com/9780321591210?portal=informit
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin
I am a Cocoa expert, and I have been teaching myself Microsoft Managed
C++ (a language very different from ANSI/ISO standard C++) along with
Microsoft's CLR/CLI (.Net) frameworks.
I am still a novice with Managed C++ and .Net, but I have already
drawn some conclusions that were surprising
Let me explain how I solved the same problem:
I have an application that stores large data files via Core Data. Multiple
users access the same data at different times, and each user has a preferred
way of visualizing the data. E.g. starting point, filter sets, color coding,
etc. all differ
As an author, I humbly recommend
http://my.safaribooksonline.com/9780321591210. Check out the table of contents.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the
Why is NSTextView slow for you ? What profiling have you done, and what does
it say is taking all the time ?
I have used NSTextView happily with 100 MB text files before.
I have seen slow behavior under the following conditions:
- Change the text content (NSTextStorage) from within
There is a interesting but long rant about software installers at
http://www.bynkii.com/archives/2009/02/on_installers.html. Most of the rant is
about problems with pushing applications to remote client computers.
I'll try to keep this Cocoa related: All of the applications I develop are
I like the addition of Related Sample Code sections to the Cocoa reference
Docs. Good work Apple. Keep it up.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the
I just used the feedback button at the bottom of every Cocoa document page to
tell Apple that I like the addition of the Related Sample Code sections.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or
Calling a subclass's overridden implementation of a superclass member
function from within the super class constructor is very very
dangerous in C++. I don't believe if is even supported by the ANSI/
ISO standard, and to the extent it works at all, it is probably
compiler and linker
The Sketch.app example on your hard disk may provide guidance.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
As I recall, this sample code does exactly what you want:
http://developer.apple.com/samplecode/Reducer/
I haven't looked at it for a while, so I may be mistaken.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin
One possibility that answers the following question which is similar
to yours:
When I drag the scroll bar, the view scrolls appropriately. When I
click in the empty space
beside the scroll bar, the view scrolls appropriately. When I click
on the scroll arrows, they highlight, but the view
In this forum, Scott Ribe recently wrote ...but just as you can't
rewrite Cocoa in C++ as we've seen demanded by people who don't
really understand Objective-C...
I claim that a relatively dynamic language is necessary to effectively
use Cocoa. I also claim to have very deep and thorough
The code provided looks very unusual and clearly does not follow the
Model-View-Controller design. It is almost always a bad idea to store
information in the user interface.
The following line is extremely suspect:
int count = _browserView-fileList.GetCount();
Why doesn't your
http://www.quartzcompositions.com/phpBB2/upload/details.php?file=378
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at
Custom sheets don't spontaneously show themselves. Right before you send
messages to display a sheet, reconfigure the sheet as desired. Better yet, add
a method to the window controller for the sheet and implement that method to
both do the special configuration and show the sheet on the
You don't have to draw outside of -drawRect:. Instead of invalidating
the table, just call -setNeedsDisplayInRect: or -displayInRect: and
pass only the rect of the row that needs to be redrawn.
___
Cocoa-dev mailing list
See http://www.stepwise.com/Articles/2006/eb1/index.html
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
See http://theocacao.com/document.page/497
See http://www.wilshipley.com/blog/2005/09/jpeg2000-cool-but-slow.html
See
http://www.macresearch.org/cocoa-tutorial-image-kit-and-image-browser-views-part-i
See
I use Core Data to store large amounts of 3D vector data. I solved your
problem in the following way:
I have a Vector3D entity that you can think of as an end point in your
model. My Vector3D entity has x,y,z attributes.
I have a Vector3DReference entity.
Vector3D has a to many
As another refinement, store all of your end points as an array of float.
Store the array in NSData. Have an entity called EndPointStorage that has an
NSData attribute, endpoints.
The Vector3DReference entity can then have an integer attribute called
endPointIndex. Use endPointIndex to
If you write correct accessors for all outlets, then the retain/release memory
management is entirely handled in one method. the -set retains the new value
and releases the old value.
Any confusion regarding memory management for IB outlets seems to stem from
failure to write the accessors
Open GL has no built-in capability for drawing text. Open GL provides lower
level primitives like lines and curves and meshes. Open GL also provides
texture compositing.
There are some free and some open text drawing/font solutions for Open GL. You
can use the GLUT library up to a point.
See http://www.cocoabuilder.com/archive/message/cocoa/2002/6/16/69399
Just put an array in you nib. Connect all of the objects of interest to the
array. In you controller code, use one outlet to the array.
___
Cocoa-dev mailing list
Blatant plug:
See also http://safari.informit.com/9780321591210
Part I: One Pattern to Rule Them All
Model View Controller
Examples of MVC in Apple Frameworks
Chapter 1. Model View Controller
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
If you watch this video from 1995 and the particularly three
subsequent parts of the video, you'll see that NeXT offered an
interesting technology for seamless communication between Openstep/
Cocoa objects on the server and rich Windows clients running Excel and
Visual Basic applications:
--- On Mon, 10/6/08, I. Savant [EMAIL PROTECTED] wrote:
What of the Graphics Bindings example mmalc has on his examples
page? Here:
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
I am not sure what Mmalc was attempting in his example. I looked at it again
just now.It seems to
I am very confused here. KVO has nothing to do with a call like
valueForKeyPath:, other than the obvious fact that they are both built
on the idea of key paths. The
observeValueForKeyPath:ofObject:change:context: method doesn't
interact with valueForKeyPath: in any way, and so I don't really
- setContinuous:
setContinuous:
Sets whether the receiver’s cell sends its action message continuously to its
target during mouse tracking.
- (void)setContinuous:(BOOL)flag
Parameters
flag
YES if the action message should be sent continuously; otherwise, NO.
See the - (id)targetForAction:(SEL)aSelector method. When adding context menu
items, if the target for the menu item's action would be nil, just don't add
the menu item.
However, I recommend adding all menu items that are ever available and just
disabling the ones that aren't currently
We have all seen the ubiquitous OK Cancel buttons. Many people have
recommended more descriptive names that include verbs for button labels.
I just ran across a Cocoa application that shall remain nameless. I attempted
to cancel a long running operation by pressing a Cancel button, and an
To add to the answer:
http://www.cocoabuilder.com/archive/message/cocoa/2005/9/30/147205
It's also worth noting that a search of the archives reveals literally
100 answers to this and similar questions.
___
Cocoa-dev mailing list
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
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 mind
Does NSNotificationCenter use zeroing weak references to observers ?
I want to say When using Cocoa’s automated memory garbage collection,
NSNotificationCenter automatically un-registers observers that are no
longer in use somewhere else in the application. I'm just not sure
it's true.
But the question I think is still valid and one I'm I'm trying to
figure out myself. How, for instance, would you have the view request
data from the document (or any other object for that matter). I
understand that it may not always be the best design choices but how
is it done? Posting
You could add a category to NSArray...
@implementation NSArray (ArrayOfStringsAsSingleString)
- (NSString *)arrayOfStringsAsSingleString { return [self
componentsJoinedByString:@, ]; }
@end
...and then bind to values.arrayOfStringsAsSingleString.
Um, why not just bind to
Can anybody point me to some good tutorials/guides for implementing
custom controls?
Do you have some objection to the examples at developer.apple.com ?
http://developer.apple.com/samplecode/Clock_Control/index.html
http://developer.apple.com/samplecode/TrackBall/
@implementation MyClass
int privateVariable; // this is an instance variable
@end
and
int privateVariable; // this is a global variable
@implementation MyClass
@end
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post
On Jul 29, 2008, at 7:19 PM, Erik Buck wrote:
@implementation MyClass
int privateVariable; // this is an instance variable
@end
and
int privateVariable; // this is a global variable
@implementation MyClass
@end
Never mind. both declarations above are global variables.
@interface
Is something like this a decent Cocoa approach:
// create the window
myWindow = [[NSWindow alloc] initWithContentRect: ... ];
// insert the existing matrix as it's content view
[myWindow setContentView:myMatrix];
// alter the position of the matrix
NSPoint newPoint = ...
Warning: Blatant self serving plug:
Target/Action, Delegates, and Notifications are all software design patterns.
They aren't even unique to Cocoa, but Cocoa has particularly elegant
implementations.
You can read/review all about these patterns and more including analysis of
the
As is the case with all NSViews, the frame of the view defines the area
occupied by the view in its superview's coordinate system. The bounds of a
view defines that view's own coordinate system irrespective of the frame.
Therefore, if the frame size and bounds size for a particular view are
See a break point in drawRect: and then tell us why it is being
called. Seriously, do you have some philosophical objection to using
the debugger ? Isn't this what it's for ?
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not
You ask an interesting computer science question (that's unrelated to Cocoa).
Surely the following sequence of words would produce Word[1-9]{1,2} instead
of Word[0-9]{1,2} because there is no representative 0 in the sample ?
Word1
Word2
Word5
Word8
Word11
Word19
Word23
Word45
Word77
Have a look at http://www.stepwise.com/Articles/2006/eb1/index.html
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at
You are off to a good start by trying to mimic something as well conceived and
implemented as Cocoa's -hitTest: approach.
Now, because you want to re-invent the solution, you will need to know a lot
of details about graphics programming and associated mathematics. Determining
whether a
Ashley,
As it happens, I have written a chapter in Cocoa Design Patterns
about why NSArrayController and friends exist and how to use them.
I am interested in feedback on the chapter. Contact me privately if
you want to see if we can arrange some way for you to review the
chapter.
See
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the
There are many pure C++ applications in the world that implement
undo. You don't have to use the Cocoa undo at all if portability is
important. Implement undo in C++ using the Command pattern or
whatever technique you want. Then integrate Cocoa GUI support via
menu items etc. for
1 - 100 of 130 matches
Mail list logo