Re: UIBezierPath: trying to create an array with CGPointMake

2010-12-20 Thread Graham Cox

On 20/12/2010, at 6:20 PM, colo wrote:

 Right now I am getting an error of
 error: void value not ignored as it ought to be


 - (IBAction)resetControlPoints:(id)sender
 {
 return path;

I've deleted all the stuff that's OK.

The reason for the error should now be obvious.


--Graham
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: File name issue with German umlauts

2010-12-20 Thread Ulf Dunkel

Hi Uli.

On 17.12.2010 09:59, Uli Kusterer wrote:

  Another guess is that the folder he's having an issue with maybe was created 
by such a wrong way and hence didn't get its name properly normalized ... might 
be worth trying to re-type the file name in Finder to make sure it's correct?


The app developer now found that the difference is this: When he gets a 
file/folder name from the Finder, the German umlauts are decomposed 
(e.g. ä becomes two chars: the a and the ¨) while typing it 
directly in the app's search field he gets only one char, the ä.


Because the app is looking for file dupes, the costs are much higher 
when he adjusts all found file specs instead of decomposing the search 
string from his app. This way he could now fix this issue.


Thanks to all of you who gave their suggestions.

---UlfDunkel

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?

2010-12-20 Thread Aurélien Hugelé
BTW, the main thread sent notification (when main thread moc is saved) does not 
contain the NSRefreshedObjects key.
This would probably be a solution to my problem, but 
mergeChangesFromContextDidSaveNotification: either does not refresh objects 
(strange) or their is something wrong since objects are definitely refreshed, 
so why does NSRefreshedObjects key is not in the didSaveNotification ?


Aurélien,
Objective Decision Team




Le 20 déc. 2010 à 06:49, Aurélien Hugelé a écrit :

 Hi!
 
 I think mergeChangesFromContextDidSaveNotification: does not work as most 
 people expect:
 I have a mainthread and a subthread. My subthread updates a managed object 
 (change one of the property value) and save.
 In the mainthread, I use [mainThreadContext 
 mergeChangesFromContextDidSaveNotification:subThreadNotification]; and it 
 merges the main thread context as expected (binded UI is updated)
 
 What is not expected is :
 
 1/ asking the main thread for its updatedObjects (just after the 
 mergeChangesFromContext... but before the save:) does not show the changes 
 made in the subthread! So updated objects in subthread are not seen as 
 updated in the main thread after the mergeChangesFromContext call!
 2/ Saving the main thread generates a did save notification, that does not 
 contain changes made in the subthread (and merged) !
 
 The subthread is temporary (does it job in an NSOperation that terminates 
 quickly), its context is also temporary. 
 
 In the mainthread, *many* controllers are observers of the did save 
 notification of the main thread context. How am I supposed to make them 
 listen to changes made in a temporary, dumb, subthreaded managed context 
 without using mergeChangesFromContext... call ???
 
 I'm pertty sure, most developers expect the 
 mergeChangesFromContextDidSaveNotification: API to really merge the data in 
 the main thread context and set the merged updated objects as *really* 
 updated, as if the change really occured in the main thread!
 
 Aurélien,
 Objective Decision Team
 
 ___
 
 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
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/hugele.aurelien%40objective-decision.com
 
 This email sent to hugele.aurel...@objective-decision.com

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Modal loop memory leak on 10.6

2010-12-20 Thread Jo Meder
Hi,

On 10.6.5 I'm seeing a runaway memory leak in my app when I show a modal 
dialog. I'm not seeing the leak in the same situation on 10.5. The modal loop 
is run using [NSApplication runModalSession:].

Using Instruments to look at allocations I'm seeing that many instances of 
CFArray, NSConcreteNotification and CFRunLoopObserver are being allocated and 
not disposed of. Here some stack crawls:

For CFArray:

  3858.03 MB CFArray :0
  37 CoreFoundation   58.03 MB _CFRuntimeCreateInstance
  36 CoreFoundation   58.03 MB __CFArrayInit
  35 CoreFoundation   46.43 MB __CFXNotificationPost
  34 CoreFoundation   46.43 MB _CFXNotificationPostNotification
  33 Foundation   46.43 MB -[NSNotificationCenter 
postNotificationName:object:userInfo:]
  32 CoreFoundation   23.21 MB -[NSArray makeObjectsPerformSelector:]
  31 AppKit   23.21 MB -[NSApplication(NSWindowCache) 
_updateWindowsUsingCache]
  30 AppKit   23.21 MB -[NSApplication updateWindows]
  29 AppKit   23.21 MB _handleWindowsNeedUpdateNote
  28 CoreFoundation   23.21 MB __CFRunLoopDoObservers
  27 CoreFoundation   23.21 MB __CFRunLoopRun
  26 CoreFoundation   23.21 MB CFRunLoopRunSpecific
  25 HIToolbox   23.21 MB RunCurrentEventLoopInMode
  24 HIToolbox   23.21 MB ReceiveNextEventCommon
  23 HIToolbox   23.21 MB BlockUntilNextEventMatchingListInMode
  22 AppKit   23.21 MB _DPSNextEvent
  21 AppKit   23.21 MB -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
  20 AppKit   23.21 MB -[NSApplication _realDoModalLoop:peek:]
  19 AppKit   23.21 MB -[NSApplication runModalSession:]
  18 tglib   23.21 MB 
UnderC::details::UCMacEventManagerImp::RunModalLoopForDialog(UnderC::UCDialog 
const)
  17 tglib   23.21 MB 
UnderC::UCEventManager::RunModalLoopForDialog(UnderC::UCDialog const)

For NSConcreteNotification:

  3846.43 MB NSConcreteNotification :0
  37 libSystem.B.dylib   46.43 MB calloc
  36 libobjc.A.dylib   46.43 MB _internal_class_createInstanceFromZone
  35 Foundation   46.43 MB NSAllocateObject
  34 Foundation   46.43 MB +[NSConcreteNotification 
newTempNotificationWithName:object:userInfo:]
  33 Foundation   46.43 MB -[NSNotificationCenter 
postNotificationName:object:userInfo:]
  32 CoreFoundation   23.21 MB -[NSArray makeObjectsPerformSelector:]
  31 AppKit   23.21 MB -[NSApplication(NSWindowCache) 
_updateWindowsUsingCache]
  30 AppKit   23.21 MB -[NSApplication updateWindows]
  29 AppKit   23.21 MB _handleWindowsNeedUpdateNote
  28 CoreFoundation   23.21 MB __CFRunLoopDoObservers
  27 CoreFoundation   23.21 MB __CFRunLoopRun
  26 CoreFoundation   23.21 MB CFRunLoopRunSpecific
  25 HIToolbox   23.21 MB RunCurrentEventLoopInMode
  24 HIToolbox   23.21 MB ReceiveNextEventCommon
  23 HIToolbox   23.21 MB BlockUntilNextEventMatchingListInMode
  22 AppKit   23.21 MB _DPSNextEvent
  21 AppKit   23.21 MB -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
  20 AppKit   23.21 MB -[NSApplication _realDoModalLoop:peek:]
  19 AppKit   23.21 MB -[NSApplication runModalSession:]
  18 tglib   23.21 MB 
UnderC::details::UCMacEventManagerImp::RunModalLoopForDialog(UnderC::UCDialog 
const)
  17 tglib   23.21 MB 
UnderC::UCEventManager::RunModalLoopForDialog(UnderC::UCDialog const)

For CFRunLoopObserver:

  2427.08 MB CFRunLoopObserver :0
  23 CoreFoundation   27.08 MB _CFRuntimeCreateInstance
  22 CoreFoundation   27.08 MB CFRunLoopObserverCreate
  21 AppKit   27.08 MB -[NSApplication setWindowsNeedUpdate:]
  20 AppKit   27.08 MB -[NSApplication _realDoModalLoop:peek:]
  19 AppKit   27.08 MB -[NSApplication runModalSession:]
  18 tglib   27.08 MB 
UnderC::details::UCMacEventManagerImp::RunModalLoopForDialog(UnderC::UCDialog 
const)
  17 tglib   27.08 MB 
UnderC::UCEventManager::RunModalLoopForDialog(UnderC::UCDialog const)

It looks like it's something to do with updating windows. It just keeps 
allocating these objects until after a fairly short time it crashes when it 
runs out of address space. It's growing in 20 MB steps as you watch it.

I have a smaller testbed app for testing my GUI framework and a modal dialog 
shown in the same way doesn't show the same memory leak that doing it in the 
main app does, so it could well be something to do with my code. However has 
any seen this sort of behaviour before and have any pointers as to what might 
be going awry? I'm out of ideas at the moment.

Regards,

Jo Meder 

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Cocoa view gets sluggish over time

2010-12-20 Thread Artemiy Pavlov

Hi all!

I have a Cocoa view that reacts to -mouseDown and -mouseDragged events  
and then draws something via -drawRect method.


It has about 50 objects that are either NSBezierCurve or NSTextField.  
The problem is, after a few seconds of mouse dragging, the view  
becomes very sluggish. I release all of the NSTextField and NSString  
objects immediately after drawing them.


What could be causing this slow-down? I'd appreciate any advise.


Thanks and best wishes,

Artemiy.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time

2010-12-20 Thread Richard Somers

Two suggestions.

One, you can verify that you are not leaking using one of the tools  
provided, Instruments or MallocDebug.


Two, I think you need to provide code examples for list members to  
provide constructive comments.


--Richard Somers

On Dec 20, 2010, at 6:31 AM, Artemiy Pavlov wrote:

I have a Cocoa view that reacts to -mouseDown and -mouseDragged  
events and then draws something via -drawRect method.


It has about 50 objects that are either NSBezierCurve or  
NSTextField. The problem is, after a few seconds of mouse dragging,  
the view becomes very sluggish. I release all of the NSTextField and  
NSString objects immediately after drawing them.


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time

2010-12-20 Thread Mike Abdullah
Use Instruments to find out where the slowness lies. Come back once you'e got 
more information and still don't know the cause.

On 20 Dec 2010, at 13:31, Artemiy Pavlov wrote:

 Hi all!
 
 I have a Cocoa view that reacts to -mouseDown and -mouseDragged events and 
 then draws something via -drawRect method.
 
 It has about 50 objects that are either NSBezierCurve or NSTextField. The 
 problem is, after a few seconds of mouse dragging, the view becomes very 
 sluggish. I release all of the NSTextField and NSString objects immediately 
 after drawing them.
 
 What could be causing this slow-down? I'd appreciate any advise.
 
 
 Thanks and best wishes,
 
 Artemiy.
 ___
 
 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
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.net

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time

2010-12-20 Thread Artemiy Pavlov
Richard, here is the code I am using, here x, y, i are variables that  
define the label position and text.


If I comment this snippet, my view is working well. So I am sure that  
there is something in these lines that needs to be done properly,  
which I don't know ;-)


		NSTextField *PatternStepLabel = [[NSTextField alloc]  
initWithFrame:NSMakeRect(x, y, 20, 20)];		
		NSString *PatternStepLabelString = [NSString stringWithFormat:@%d,  
i];


[PatternStepLabel setEditable:NO];
[PatternStepLabel setDrawsBackground:NO];
[PatternStepLabel setSelectable:NO];
[PatternStepLabel setBezeled:NO];
[PatternStepLabel setAlignment:2];
[PatternStepLabel setTextColor:StepColor];
[PatternStepLabel setStringValue:PatternStepLabelString];
[PatternStepLabel setFont:[NSFont fontWithName:@Courier 
size:8.0]];
[self addSubview:PatternStepLabel];

[PatternStepLabelString release];
[PatternStepLabel release];


On 20 Dec 2010, at 16:02, Richard Somers wrote:


Two suggestions.

One, you can verify that you are not leaking using one of the tools  
provided, Instruments or MallocDebug.


Two, I think you need to provide code examples for list members to  
provide constructive comments.


--Richard Somers

On Dec 20, 2010, at 6:31 AM, Artemiy Pavlov wrote:

I have a Cocoa view that reacts to -mouseDown and -mouseDragged  
events and then draws something via -drawRect method.


It has about 50 objects that are either NSBezierCurve or  
NSTextField. The problem is, after a few seconds of mouse dragging,  
the view becomes very sluggish. I release all of the NSTextField  
and NSString objects immediately after drawing them.




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time

2010-12-20 Thread Artemiy Pavlov

I have run Instruments and I see a ton of these calls:

-[NSWindow fieldEditor:forObject:]

So I indeed see that there's something I am not doing right with the  
NSTextField.


On 20 Dec 2010, at 16:09, Mike Abdullah wrote:

Use Instruments to find out where the slowness lies. Come back once  
you'e got more information and still don't know the cause.


On 20 Dec 2010, at 13:31, Artemiy Pavlov wrote:


Hi all!

I have a Cocoa view that reacts to -mouseDown and -mouseDragged  
events and then draws something via -drawRect method.


It has about 50 objects that are either NSBezierCurve or  
NSTextField. The problem is, after a few seconds of mouse dragging,  
the view becomes very sluggish. I release all of the NSTextField  
and NSString objects immediately after drawing them.


What could be causing this slow-down? I'd appreciate any advise.


Thanks and best wishes,

Artemiy.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.net




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTextField: text appears aliased

2010-12-20 Thread Artemiy Pavlov

Hi all!

I have a few text labels I created using NSTextField. However, all of  
them appear very aliased, as shown in the attached screenshot. Can  
anyone suggest me how I can fix this and turn on antialiasing for the  
text?


Thanks and best wishes,

Artemiy.


inline: Picture 1.png

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSTextField: text appears aliased

2010-12-20 Thread Jerry Krinock

On 2010 Dec 20, at 06:30, Artemiy Pavlov wrote:

 I have a few text labels I created using NSTextField. However, all of them 
 appear very aliased, as shown in the attached screenshot. Can anyone suggest 
 me how I can fix this and turn on antialiasing for the text?

I've seen this happen when the view is drawn multiple times, or if you have 
multiple identical views in the same place.  Check your code.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time

2010-12-20 Thread Artemiy Pavlov

I think I know what's the problem, it's this line.

[self addSubview:PatternRateLabel];

With each -drawRect call, NSTextField objects are not being redrawn  
from scratch, they are added on top of the existing ones. So I end up  
with thousands of them.


I guess I need to put this code in -awakeFromNib. And then, if needed,  
change the text field strings or properties in -drawRect.



All the best,

Artemiy.

On 20 Dec 2010, at 16:25, Artemiy Pavlov wrote:


I have run Instruments and I see a ton of these calls:

-[NSWindow fieldEditor:forObject:]

So I indeed see that there's something I am not doing right with the  
NSTextField.


On 20 Dec 2010, at 16:09, Mike Abdullah wrote:

Use Instruments to find out where the slowness lies. Come back once  
you'e got more information and still don't know the cause.


On 20 Dec 2010, at 13:31, Artemiy Pavlov wrote:


Hi all!

I have a Cocoa view that reacts to -mouseDown and -mouseDragged  
events and then draws something via -drawRect method.


It has about 50 objects that are either NSBezierCurve or  
NSTextField. The problem is, after a few seconds of mouse  
dragging, the view becomes very sluggish. I release all of the  
NSTextField and NSString objects immediately after drawing them.


What could be causing this slow-down? I'd appreciate any advise.


Thanks and best wishes,

Artemiy.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.net




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/artemiy.pavlov%40ukrpost.ua

This email sent to artemiy.pav...@ukrpost.ua


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField: text appears aliased

2010-12-20 Thread Artemiy Pavlov


On 2010 Dec 20, at 06:30, Artemiy Pavlov wrote:

I have a few text labels I created using NSTextField. However, all  
of them appear very aliased, as shown in the attached screenshot.  
Can anyone suggest me how I can fix this and turn on antialiasing  
for the text?


I've seen this happen when the view is drawn multiple times, or if  
you have multiple identical views in the same place.  Check your code.


No, I have this in -awakeFromNib and I only have one view. Do I have  
to load a font in some special way, with some options set, maybe  
that's the issue?


Thanks a lot,

Artemiy.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time (solved!)

2010-12-20 Thread Artemiy Pavlov


I guess I need to put this code in -awakeFromNib. And then, if  
needed, change the text field strings or properties in -drawRect.


Yes, that did the trick! I now set up these labels in -awakeFromNib  
and the view is working well now. Glad I was able to figure it out.



Artemiy.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField: text appears aliased

2010-12-20 Thread Siegfried

On 20/12/2010, at 12:30, Artemiy Pavlov wrote:

 Hi all!
 
 I have a few text labels I created using NSTextField. However, all of them 
 appear very aliased, as shown in the attached screenshot. Can anyone suggest 
 me how I can fix this and turn on antialiasing for the text?
 

Sincerely, they don't look aliased at my eyes.

So I decided to scale the image 4x. See the image attached.

Try changing to black text over white background then we will see if this is a 
problem or just a wrong impression caused by the colors.

inline: Picture 1.png
 Thanks and best wishes,
 
 Artemiy.
 
 
 Picture 1.png
 ___
 
 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
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/triebschen.siegfried.idyll%40gmail.com
 
 This email sent to triebschen.siegfried.id...@gmail.com

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSTextField: text appears aliased

2010-12-20 Thread Artemiy Pavlov

Hi all,

thanks a lot for the replies!

No I do not use anything special there.

Just a black NSRect with NSTextFields on top of them. I think I could  
solve this by using a shadow under the text, however, I don't know how  
to do this. The normal shadow mechanism as I use for NSBezierCurve  
doesn't seem to affect NSTextFields.



Thanks and best wishes,

Artemiy.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


access multiple NSTextFields as an array?

2010-12-20 Thread Artemiy Pavlov

Hi all!

I have a row of number labels that I create like so:

for(i=1;i=16;i++){
NSTextField *NumberLabel = [[NSTextField alloc]  
initWithFrame:NSMakeRect(...)];   

   [NumberLabel setStringValue:[NSString stringWithFormat:@%d, i]];
   [self addSubview:PatternStepLabel];  
}

The end result looks like attached in the screenshot.

Now, I'd like to be able to access each one of these NSTextField  
objects to change their color. My question is, right in this loop, can  
I create some sort of an array of pointers to these objects?


Or am limited to creating each object separately, i.e. NumberLabel1,  
NumberLabel2 and so on?



Thanks and best wishes,

Artemiy.

inline: Picture 1.png

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSTextField: text appears aliased

2010-12-20 Thread Artemiy Pavlov
You guys are right, all is actually well, it might have been that  
Helvetica isn't the prettiest font to use in this color scheme. I  
changed it to Lucida Grande and it's looking properly sleek now :-)


inline: Picture 1.png___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: access multiple NSTextFields as an array?

2010-12-20 Thread Eric E. Dolecki
Use .tag and set it to i.


  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net



On Mon, Dec 20, 2010 at 10:38 AM, Artemiy Pavlov
artemiy.pav...@ukrpost.uawrote:

 Hi all!

 I have a row of number labels that I create like so:

 for(i=1;i=16;i++){
NSTextField *NumberLabel = [[NSTextField alloc]
 initWithFrame:NSMakeRect(...)];   
   [NumberLabel setStringValue:[NSString stringWithFormat:@%d, i]];
   [self addSubview:PatternStepLabel];
 }

 The end result looks like attached in the screenshot.

 Now, I'd like to be able to access each one of these NSTextField objects to
 change their color. My question is, right in this loop, can I create some
 sort of an array of pointers to these objects?

 Or am limited to creating each object separately, i.e. NumberLabel1,
 NumberLabel2 and so on?


 Thanks and best wishes,

 Artemiy.




 ___

 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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com

 This email sent to edole...@gmail.com

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Roland King
if those are the only views you can use

[ self subviews ]

to get an array of them in the order they are currently stacked. 

On 20-Dec-2010, at 11:38 PM, Artemiy Pavlov wrote:

 Hi all!
 
 I have a row of number labels that I create like so:
 
 for(i=1;i=16;i++){
NSTextField *NumberLabel = [[NSTextField alloc] 
 initWithFrame:NSMakeRect(...)];   
   [NumberLabel setStringValue:[NSString stringWithFormat:@%d, i]];
   [self addSubview:PatternStepLabel]; 
 }
 
 The end result looks like attached in the screenshot.
 
 Now, I'd like to be able to access each one of these NSTextField objects to 
 change their color. My question is, right in this loop, can I create some 
 sort of an array of pointers to these objects?
 
 Or am limited to creating each object separately, i.e. NumberLabel1, 
 NumberLabel2 and so on?
 
 
 Thanks and best wishes,
 
 Artemiy.
 
 Picture 1.png
 ___
 
 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
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.org

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Siegfried

On 20/12/2010, at 13:38, Artemiy Pavlov wrote:

 Now, I'd like to be able to access each one of these NSTextField objects to 
 change their color. My question is, right in this loop, can I create some 
 sort of an array of pointers to these objects?

Just create a NSMutableArray before the loop:

NSMutableArray *array = [NSMutableArray arrayWithCapacity:16];

And then add each field to the array right in the loop

for (…) {
…
   [array addObject:textField];
}



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIBezierPath: trying to create an array with CGPointMake

2010-12-20 Thread Fritz Anderson
On 20 Dec 2010, at 1:20 AM, colo wrote:

 I'm in the processing of trying to create an array of Path points to
 draw a UIBezierPath CGRectMake onto each control point.
 
 Right now I am getting an error of
 error: void value not ignored as it ought to be
…
 - (IBAction)resetControlPoints:(id)sender
 {
 
 UIBezierPath *path = [UIBezierPath bezierPath]; {
 [path moveToPoint:CGPointMake(0,0)];
 return path;
 }
 points[0] =   [path moveToPoint:CGPointMake(30, 70)];
 points[1] =   [path moveToPoint:CGPointMake(30, 70)];
 points[2] =   [path moveToPoint:CGPointMake(30, 70)];
 points[3] =   [path moveToPoint:CGPointMake(30, 70)];
 
 }

Look at the documentation for -[UIBezierPath moveToPoint:]. The method returns 
void, but you're trying to assign the (nonexistent) result to members of the 
points[] array. You ought to be ignoring the void value, and aren't, just as 
the error message says.

You're returning path immediately after initializing it. Your assignments to 
points[] won't get executed anyway.

You're attempting to return path from a void method (IBAction methods return 
void). Attempting to return a value from a void method is at least a warning. 
Never ignore warnings.

Given that you can't return anything from an IBAction — nothing will receive 
the returned value — what do you expect to happen to path? In the method you 
show, it gets allocated, autoreleased, initialized, and thrown away.

Assuming you mean to use the four {30,70} points you refer to, (points[0] = 
CGPointMake(30, 70);), why do you think it necessary to reset the current point 
to that location?

If you do mean to reset the current point, why do it four times?

Assuming you don't mean the early return, why initially set the current point 
to {0,0} if you're just going to reset it?

And why are you enclosing those two lines in braces?

— F

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Artemiy Pavlov

Just create a NSMutableArray before the loop:

NSMutableArray *array = [NSMutableArray arrayWithCapacity:16];

And then add each field to the array right in the loop

for (…) {
   …
  [array addObject:textField];
}


Great, thanks a lot! Can I then access each element via array[0],  
array[1] etc.? I.e. will [array[0] setColor:...] work?



Thanks again,

Artemiy.___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Modal loop memory leak on 10.6

2010-12-20 Thread Fritz Anderson
On 20 Dec 2010, at 4:04 AM, Jo Meder wrote:

 It looks like it's something to do with updating windows. It just keeps 
 allocating these objects until after a fairly short time it crashes when it 
 runs out of address space. It's growing in 20 MB steps as you watch it.
 
 I have a smaller testbed app for testing my GUI framework and a modal dialog 
 shown in the same way doesn't show the same memory leak that doing it in the 
 main app does, so it could well be something to do with my code. However has 
 any seen this sort of behaviour before and have any pointers as to what might 
 be going awry? I'm out of ideas at the moment.

We don't have your code (and there may be a lot of it before we can find the 
bug), so I'm just going on brute instinct…

Are you doing anything other than strict, narrow, 
swear-on-your-mother's-life-it's-only, drawing in drawRect:? Are you changing 
model state? Calling back to a controller action? Are you trying to trigger 
redraws?

— F

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Siegfried

On 20/12/2010, at 14:01, Artemiy Pavlov wrote:

 Just create a NSMutableArray before the loop:
 
 NSMutableArray *array = [NSMutableArray arrayWithCapacity:16];
 
 And then add each field to the array right in the loop
 
 for (…) {
   …
  [array addObject:textField];
 }
 
 Great, thanks a lot!

You're welcome :-)

 Can I then access each element via array[0], array[1] etc.? I.e. will 
 [array[0] setColor:...] work?

No! This is not a C array, it's an object. Use -objectAtIndex instead I.e. 
[[array objectAtIndex:0]  setColor:…]

Check documentation for NSArray and NSMutableArray for more info, it's your 
friend! :-)___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread aglee

On Dec 20, 2010, at 11:11 AM, Siegfried triebschen.siegfried.id...@gmail.com 
wrote:
Check documentation for NSArray and NSMutableArray for more info, it's your 
friend! :-)

And an easy way to do this is by Option-Command-double-clicking on NSArray and 
NSMutableArray in your code.

Note that NSMutableArray inherits from NSArray.

--Andy

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Artemiy Pavlov
Can I then access each element via array[0], array[1] etc.? I.e.  
will [array[0] setColor:...] work?


No! This is not a C array, it's an object. Use -objectAtIndex  
instead I.e. [[array objectAtIndex:0]  setColor:…]


Check documentation for NSArray and NSMutableArray for more info,  
it's your friend! :-)


Yes, I did this after sending this e-mail :-) Weird though, that it  
doesn't work straight away... Here is my code:


int x;
NSMutableArray *Array;

for(x=1;x=9;x++){
NSTextField *PatternRateLabel = etc. etc.
[Array addObject:PatternRateLabel];
}

[[Array objectAtIndex:0] setColor:...]

However, if I have this last line, my view freezes... Maybe I do not  
create the array properly?



All the best,

Artemiy.___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIBezierPath: trying to create an array with CGPointMake

2010-12-20 Thread colo
 Look at the documentation for -[UIBezierPath moveToPoint:]. The method 
 returns void, but you're trying to assign the (nonexistent) result to members 
 of the points[] array. You ought to be ignoring the void value, and aren't, 
 just as the error message says.

 You're returning path immediately after initializing it. Your assignments to 
 points[] won't get executed anyway.

 You're attempting to return path from a void method (IBAction methods return 
 void). Attempting to return a value from a void method is at least a warning. 
 Never ignore warnings.

 Given that you can't return anything from an IBAction — nothing will receive 
 the returned value — what do you expect to happen to path? In the method you 
 show, it gets allocated, autoreleased, initialized, and thrown away.

 Assuming you mean to use the four {30,70} points you refer to, (points[0] = 
 CGPointMake(30, 70);), why do you think it necessary to reset the current 
 point to that location?

 If you do mean to reset the current point, why do it four times?

 Assuming you don't mean the early return, why initially set the current point 
 to {0,0} if you're just going to reset it?

 And why are you enclosing those two lines in braces?

        — F


Because i'm really stupid. :P I'm truly hacking away trying to
translate the following method of code into iOS specific code to run
on the ipad. I'm still totally in a learning stage, cram a widget into
a socket and see if it works. No real good arguments for the way I am
trying this, but I can't seem to find a translation list for
converting methods of NSRect = CGRect = iOS UIBezierPath.

I thank you for the heads up on the Void issue. My fault. What I was
trying to find was a replacement for NSMakePoint, I saw the naming
scheme CGPointMake but could not get it to give me a decent compile
without using CGPointMake in some type of attribute of UIBezierPath
hence the moveToPoint, I thought there might be a createPointAt but
don't see anything like that.

Previous Cocoa code
- (IBAction)resetControlPoints:(id)sender
{
NSRect bounds = [self bounds];

points[0] = NSMakePoint(0.25 * bounds.size.width, 0.25 * 
bounds.size.height);
points[1] = NSMakePoint(0.25 * bounds.size.width, 0.75 * 
bounds.size.height);
points[2] = NSMakePoint(0.75 * bounds.size.width, 0.75 * 
bounds.size.height);
points[3] = NSMakePoint(0.75 * bounds.size.width, 0.25 * 
bounds.size.height);

[self setNeedsDisplay:YES];
}
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Artemiy Pavlov

My apologies, the full code is this:

int x;
NSMutableArray *Array = [NSMutableArray arrayWithCapacity:9];

for(x=1;x=9;x++){
   NSTextField *PatternRateLabel = etc. etc.
   [Array addObject:PatternRateLabel];
}

[[Array objectAtIndex:0] setColor:...];


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Fritz Anderson
On 20 Dec 2010, at 10:16 AM, Artemiy Pavlov wrote:

 int x;
 NSMutableArray *Array;
 
 for(x=1;x=9;x++){
NSTextField *PatternRateLabel = etc. etc.
[Array addObject:PatternRateLabel];
 }
 
 [[Array objectAtIndex:0] setColor:...]
 
 However, if I have this last line, my view freezes... Maybe I do not create 
 the array properly?

You have to allocate and initialize your array. This is an elementary-level 
problem, and you will have worse and worse problems unless have a good grasp of 
the collection classes in Foundation. Apple's documentation has a Collections 
Programming Topics article to get you started.

— F

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Scott Ribe
On Dec 20, 2010, at 9:16 AM, Artemiy Pavlov wrote:

 Yes, I did this after sending this e-mail :-) Weird though, that it doesn't 
 work straight away... Here is my code:

You're not creating the array.

Anyway, there's no need for an NSMutableArray. You can just have a plain C 
array as an attribute of your class, and set up its entries in awakeFromNib:

patterRateLabels[0] = numberLabel1;
patterRateLabels[1] = numberLabel2;
...

Or if it works for your spacing and so on, you could use an NSMatrix to set up 
the text labels...

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time

2010-12-20 Thread aglee

On Dec 20, 2010, at 09:13 AM, Artemiy Pavlov artemiy.pav...@ukrpost.ua wrote:
NSTextField *PatternStepLabel = [[NSTextField alloc] 
initWithFrame:NSMakeRect(x, y, 20, 20)];	
NSString *PatternStepLabelString = [NSString stringWithFormat:@%d, 
i];


[PatternStepLabel setEditable:NO];
[PatternStepLabel setDrawsBackground:NO];
[PatternStepLabel setSelectable:NO];
[PatternStepLabel setBezeled:NO];
[PatternStepLabel setAlignment:2];
[PatternStepLabel setTextColor:StepColor];
[PatternStepLabel setStringValue:PatternStepLabelString];
[PatternStepLabel setFont:[NSFont fontWithName:@Courier size:8.0]];
[self addSubview:PatternStepLabel];

[PatternStepLabelString release];
[PatternStepLabel release];
 
You seem to have solved your main problem, so I'll just comment on a couple of 
other things.

(1) You are over-releasing PatternStepLabelString.

stringWithFormat: returns an object you do not own, which means you are not 
responsible for releasing it.  In fact, you must not release it, because 
releasing an object too many times will cause your program to crash.

Note that it is correct to release PatternStepLabel, because alloc returns an 
object that you do own.  You must release it (either right away or later via 
autorelease), or it will be a memory leak.

See 
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html,
 in particular Memory Management Rules.

(2) Unless you need PatternStepLabelString for something else, you can 
eliminate it altogether by using setIntValue: instead of setStringValue: as 
follows.

[PatternStepLabel setIntValue:i];
 
(3) The convention in Cocoa is to begin variables with lowercase letters, like 
this:

NSTextField *patternStepLabel;
NSString *patternStepLabelString;

If you work with other Cocoa developers, or even if you paste code into emails 
like this one, you can make the code easier for others to read by sticking to 
convention.

--Andy

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Siegfried

On 20/12/2010, at 14:23, Artemiy Pavlov wrote:

 My apologies, the full code is this:
 
 int x;
 NSMutableArray *Array = [NSMutableArray arrayWithCapacity:9];
 
 for(x=1;x=9;x++){
   NSTextField *PatternRateLabel = etc. etc.
   [Array addObject:PatternRateLabel];
 }
 

This line:

 [[Array objectAtIndex:0] setColor:...];
 

Maybe you want to use -setTextColor ?
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Artemiy Pavlov

[[Array objectAtIndex:0] setColor:...];



Maybe you want to use -setTextColor ?
___


Yes, sorry, I have setTextColor actually. Still, it doesn't work... 
___


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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Siegfried

On 20/12/2010, at 14:39, Artemiy Pavlov wrote:

 Thanks for the help, Siegfried!
 
 My actualy code is here:
 
 NSMutableArray *Array;
 
 -(void)awakeFromNib{
 
int x;
Array = [NSMutableArray array];
 
for(x=1;x=9;x++){
NSTextField *PatternRateLabel = etc. etc.
[Array addObject:PatternRateLabel];
}
 
 }
 
 -(void)drawRect:(NSRect)rect{
 
[[Array objectAtIndex:0] setColor:...];
 
 }

1.If you want to use the array somewhere else calling -retain on it may be a 
good idea
2.Again I think that [Array objectAtIndex:0] should return a NSTextField 
instance which does not has -setColor, or maybe has. Better to check 
documentation.___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread aglee

On Dec 20, 2010, at 11:42 AM, Artemiy Pavlov artemiy.pav...@ukrpost.ua wrote:
Yes, sorry, I have setTextColor actually. Still, it doesn't work..
 

I suggest pasting your exact code into email.  Don't abbreviate and don't type 
it by hand.

--Andy

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Artemiy Pavlov
1.If you want to use the array somewhere else calling -retain on it  
may be a good idea


Oh yes!!! This did the trick! Thanks so much for the help, Siegfried.  
You saved me from a sleepless night :-)



Artemiy.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread aglee

On Dec 20, 2010, at 11:30 AM, Scott Ribe scott_r...@elevated-dev.com wrote:

Anyway, there's no need for an NSMutableArray. You can just have a plain C 
array as an attribute of your class, and set up its entries in awakeFromNib:

patterRateLabels[0] = numberLabel1;
patterRateLabels[1] = numberLabel2;
 

I don't recommend this approach.  It's safer to get the memory management 
benefits of NSMutableArray, and not worry about off-by-one or array overflow 
errors.

--Andy

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time

2010-12-20 Thread Artemiy Pavlov
Thank you very much for these tips, Andy! They are really helpful. I  
have only started to learn Cocoa three weeks ago and answers on this  
list really gave me a good kick.


All the best,

Artemiy.

You seem to have solved your main problem, so I'll just comment on a  
couple of other things.


(1) You are over-releasing PatternStepLabelString.

stringWithFormat: returns an object you do not own, which means you  
are not responsible for releasing it.  In fact, you must not release  
it, because releasing an object too many times will cause your  
program to crash.


Note that it is correct to release PatternStepLabel, because alloc  
returns an object that you do own.  You must release it (either  
right away or later via autorelease), or it will be a memory leak.


See http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html 
, in particular Memory Management Rules.


(2) Unless you need PatternStepLabelString for something else, you  
can eliminate it altogether by using setIntValue: instead of  
setStringValue: as follows.


[PatternStepLabel setIntValue:i];

(3) The convention in Cocoa is to begin variables with lowercase  
letters, like this:


NSTextField *patternStepLabel;
NSString *patternStepLabelString;

If you work with other Cocoa developers, or even if you paste code  
into emails like this one, you can make the code easier for others  
to read by sticking to convention.


--Andy



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIBezierPath: trying to create an array with CGPointMake

2010-12-20 Thread Lee Ann Rucker

On Dec 20, 2010, at 8:23 AM, colo wrote:

Because i'm really stupid. :P I'm truly hacking away trying to
translate the following method of code into iOS specific code to run
on the ipad. I'm still totally in a learning stage, cram a widget into
a socket and see if it works. No real good arguments for the way I am
trying this, but I can't seem to find a translation list for
converting methods of NSRect = CGRect = iOS UIBezierPath.

I thank you for the heads up on the Void issue. My fault. What I was
trying to find was a replacement for NSMakePoint, I saw the naming
scheme CGPointMake but could not get it to give me a decent compile
without using CGPointMake in some type of attribute of UIBezierPath
hence the moveToPoint, I thought there might be a createPointAt but
don't see anything like that.

Previous Cocoa code
- (IBAction)resetControlPoints:(id)sender
{
NSRect bounds = [self bounds];

points[0] = NSMakePoint(0.25 * bounds.size.width, 0.25 * bounds.size.height);
points[1] = NSMakePoint(0.25 * bounds.size.width, 0.75 * bounds.size.height);
points[2] = NSMakePoint(0.75 * bounds.size.width, 0.75 * bounds.size.height);
points[3] = NSMakePoint(0.75 * bounds.size.width, 0.25 * bounds.size.height);

[self setNeedsDisplay:YES];
}
__

I've ported an NSBezierPath app to a UIBezierPath app, and I'm not sure why 
you're having trouble. I got a long way with search-and-replace. What sort of 
compiler errors did you get from replacing NSMakePoint with CGPointMake? You 
did replace the NSPoint with CGPoint in the variable declaration, right?

It's open source so if you want to look at the code, go to 
http://homepage.mac.com/lrucker/XTide/ and 
http://homepage.mac.com/lrucker/TideTracker/

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: access multiple NSTextFields as an array?

2010-12-20 Thread Lee Ann Rucker

On Dec 20, 2010, at 8:16 AM, Artemiy Pavlov wrote:

 Can I then access each element via array[0], array[1] etc.? I.e.  
 will [array[0] setColor:...] work?
 
 No! This is not a C array, it's an object. Use -objectAtIndex  
 instead I.e. [[array objectAtIndex:0]  setColor:…]
 
 Check documentation for NSArray and NSMutableArray for more info,  
 it's your friend! :-)
 
 Yes, I did this after sending this e-mail :-) Weird though, that it  
 doesn't work straight away... Here is my code:
 
 int x;
 NSMutableArray *Array;

 
 for(x=1;x=9;x++){
 NSTextField *PatternRateLabel = etc. etc.
 [Array addObject:PatternRateLabel];

Convention is that only classes start with capitals, so that you can tell the 
difference between calling a class method ([Array alloc]) and calling an 
instance method ([array addObject:]) at a glance. There are some methods that 
apply to both - a class is an object, after all - so the convention is useful.

 }
 
 [[Array objectAtIndex:0] setColor:...]
 
 However, if I have this last line, my view freezes... Maybe I do not  
 create the array properly?
 
 
 All the best,
 
 Artemiy.___
 
 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
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.com

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa view gets sluggish over time

2010-12-20 Thread Graham Cox

On 21/12/2010, at 1:42 AM, Artemiy Pavlov wrote:

 With each -drawRect call, NSTextField objects are not being redrawn from 
 scratch, they are added on top of the existing ones. So I end up with 
 thousands of them.
 
 I guess I need to put this code in -awakeFromNib. And then, if needed, change 
 the text field strings or properties in -drawRect.


You got it.

In general,you should not be creating/disposing/adding objects to your data 
model (or view hierarchy) in -drawRect:. That should be strictly limited to 
drawing what you already have.

--Graham

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?

2010-12-20 Thread Ben Trumbull

On Dec 19, 2010, at 9:49 PM, Aurélien Hugelé wrote:

 Hi!
 
 I think mergeChangesFromContextDidSaveNotification: does not work as most 
 people expect:
 I have a mainthread and a subthread. My subthread updates a managed object 
 (change one of the property value) and save.
 In the mainthread, I use [mainThreadContext 
 mergeChangesFromContextDidSaveNotification:subThreadNotification]; and it 
 merges the main thread context as expected (binded UI is updated)
 
 What is not expected is :
 
 1/ asking the main thread for its updatedObjects (just after the 
 mergeChangesFromContext... but before the save:) does not show the changes 
 made in the subthread! So updated objects in subthread are not seen as 
 updated in the main thread after the mergeChangesFromContext call!
 2/ Saving the main thread generates a did save notification, that does not 
 contain changes made in the subthread (and merged) !
 
 The subthread is temporary (does it job in an NSOperation that terminates 
 quickly), its context is also temporary. 
 
 In the mainthread, *many* controllers are observers of the did save 
 notification of the main thread context. How am I supposed to make them 
 listen to changes made in a temporary, dumb, subthreaded managed context 
 without using mergeChangesFromContext... call ???
 
 I'm pertty sure, most developers expect the 
 mergeChangesFromContextDidSaveNotification: API to really merge the data in 
 the main thread context and set the merged updated objects as *really* 
 updated, as if the change really occured in the main thread!


The method is merging the state into the receiving context purely from the 
perspective of results.  Deleted objects are deleted, updated objects have new 
values, inserted objects exist.  It does not replay the individual changes, nor 
does it guarantee any particular path or implementation for getting the state 
of MOC B to look like the state of MOC A.  For efficiency, it prefers 
refreshing existing objects from the PSC's cache over replaying individual 
changes whenever possible.  

Refreshing is observable by KVO.  These objects are also noted in the 
NSManagedObjectContextObjectsDidChangeNotification with the 
NSRefreshedObjectsKey.  This is how NSArrayController observes these kinds of 
events.

The objects aren't updated in the sense that they'll be saved again.  Because 
they won't.  They've already been saved a first time.  They *were* updated, and 
NSManagedObjectContext's -updatedObjects reports the state about next upcoming 
save, not the last save.

- Ben

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Modal loop memory leak on 10.6

2010-12-20 Thread Jo Meder
Hi Fritz,

On 21/12/2010, at 5:07 AM, Fritz Anderson wrote:

 We don't have your code (and there may be a lot of it before we can find the 
 bug), so I'm just going on brute instinct…
 
 Are you doing anything other than strict, narrow, 
 swear-on-your-mother's-life-it's-only, drawing in drawRect:? Are you changing 
 model state? Calling back to a controller action? Are you trying to trigger 
 redraws?

I went through and commented out calls from drawRect: into my own code, so I'm 
not doing anything when drawRect: is called. I've also commented out all calls 
to setNeedsDisplay: and setNeedsDisplayInRect:. A lot of the drawing (OpenGL) 
in the app is triggered by timers so I've prevented the timers starting. The 
timers weren't firing anyway as they're not on the modal event loop, but just 
to be certain. I've commented out the few places I was adding observers 
directly. All to no avail, the leak is still happening.

I use Cocoa at fairly basic level because the Cocoa stuff is the back end to a 
C++ GUI framework. I'm not doing anything particularly fancy, such as KVO.

Here's how I run the modal loop just in case:

NSWindow* macWindow = ( NSWindow* )theDialog.GetNativeWindow();
UCMacWindowImp* windowImp = ( UCMacWindowImp* )theDialog.GetImplementation();

if ( ( macWindow != nil )  ( windowImp != NULL ) )
{
NSModalSession modalSession;

// Need to retain then release window because [NSApp endModalSession] seems 
to expect
   // the window to still be around on 10.4 and 10.5
[macWindow retain];
modalSession = [NSApp beginModalSessionForWindow:macWindow];
windowImp-SetModalSession( modalSession );
for (;;)
{
if ([NSApp runModalSession:modalSession] != NSRunContinuesResponse)
break;
}

[NSApp endModalSession:modalSession];
[macWindow release];
}

Thanks for your help.

Regards,

Jo Meder

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?

2010-12-20 Thread Aurélien Hugelé
Thanks Ben, after thought, this is indeed very logical and can be expected when 
you know Core Data. I came to the same conclusion but you phrased it much 
better than me :)


Aurélien,
Objective Decision Team




Le 21 déc. 2010 à 01:45, Ben Trumbull a écrit :

 
 On Dec 19, 2010, at 9:49 PM, Aurélien Hugelé wrote:
 
 Hi!
 
 I think mergeChangesFromContextDidSaveNotification: does not work as most 
 people expect:
 I have a mainthread and a subthread. My subthread updates a managed object 
 (change one of the property value) and save.
 In the mainthread, I use [mainThreadContext 
 mergeChangesFromContextDidSaveNotification:subThreadNotification]; and it 
 merges the main thread context as expected (binded UI is updated)
 
 What is not expected is :
 
 1/ asking the main thread for its updatedObjects (just after the 
 mergeChangesFromContext... but before the save:) does not show the changes 
 made in the subthread! So updated objects in subthread are not seen as 
 updated in the main thread after the mergeChangesFromContext call!
 2/ Saving the main thread generates a did save notification, that does not 
 contain changes made in the subthread (and merged) !
 
 The subthread is temporary (does it job in an NSOperation that terminates 
 quickly), its context is also temporary. 
 
 In the mainthread, *many* controllers are observers of the did save 
 notification of the main thread context. How am I supposed to make them 
 listen to changes made in a temporary, dumb, subthreaded managed context 
 without using mergeChangesFromContext... call ???
 
 I'm pertty sure, most developers expect the 
 mergeChangesFromContextDidSaveNotification: API to really merge the data in 
 the main thread context and set the merged updated objects as *really* 
 updated, as if the change really occured in the main thread!
 
 
 The method is merging the state into the receiving context purely from the 
 perspective of results.  Deleted objects are deleted, updated objects have 
 new values, inserted objects exist.  It does not replay the individual 
 changes, nor does it guarantee any particular path or implementation for 
 getting the state of MOC B to look like the state of MOC A.  For efficiency, 
 it prefers refreshing existing objects from the PSC's cache over replaying 
 individual changes whenever possible.  
 
 Refreshing is observable by KVO.  These objects are also noted in the 
 NSManagedObjectContextObjectsDidChangeNotification with the 
 NSRefreshedObjectsKey.  This is how NSArrayController observes these kinds of 
 events.
 
 The objects aren't updated in the sense that they'll be saved again.  
 Because they won't.  They've already been saved a first time.  They *were* 
 updated, and NSManagedObjectContext's -updatedObjects reports the state about 
 next upcoming save, not the last save.
 
 - Ben
 

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSKeyedArchiver on iOS and Cocoa

2010-12-20 Thread lorenzo7620
Are these two compatible? Can something archived one platform be unarchived  
on the other? I can't find anything in docs that addresses this, but I'm  
havig trouble doing precisely this (archived on iPhone, unarchived on  
MacOSX). I get the NSInvalidUnarchiveOperationException.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSKeyedArchiver on iOS and Cocoa

2010-12-20 Thread Ricky Sharp

On Dec 20, 2010, at 8:22 PM, lorenzo7...@gmail.com wrote:

 Are these two compatible? Can something archived one platform be unarchived 
 on the other? I can't find anything in docs that addresses this, but I'm 
 havig trouble doing precisely this (archived on iPhone, unarchived on 
 MacOSX). I get the NSInvalidUnarchiveOperationException.

There was a thread similar to this back in August:

http://www.cocoabuilder.com/archive/cocoa/291877-nskeyedarchiver-on-osx-to-nskeyedunarchiver-ios.html

___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Re: NSKeyedArchiver on iOS and Cocoa

2010-12-20 Thread lorenzo7620

On Dec 20, 2010 9:43pm, Ricky Sharp rsh...@mac.com wrote:



On Dec 20, 2010, at 8:22 PM, lorenzo7...@gmail.com wrote:




 Are these two compatible? Can something archived one platform be  
unarchived on the other? I can't find anything in docs that addresses  
this, but I'm havig trouble doing precisely this (archived on iPhone,  
unarchived on MacOSX). I get the NSInvalidUnarchiveOperationException.





There was a thread similar to this back in August:





http://www.cocoabuilder.com/archive/cocoa/291877-nskeyedarchiver-on-osx-to-nskeyedunarchiver-ios.html





___



Ricky A. Sharp mailto:rsh...@instantinteractive.com



Instant Interactive(tm) http://www.instantinteractive.com









Thanks for the reply. That thread is enlightening, but the problem I have  
is that I can't control how the iPhone data is persisted. I need to  
unarchive it on MacOSX and then re-encode it for use on iPhone. The data is  
all basic containers of type NSMutableDictionary. I was hoping that  
wouldn't be a problem.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Performance: Drawing hundreds of short text strings

2010-12-20 Thread Mark Coniglio
My application needs to draw hundreds of short 
text strings into an NSView. After reviewing the 
Cocoa documentation on drawing text, I am left 
unsure as to how to do this with the highest 
level of efficiency.


The text I am drawing will all be the same font 
and font size and style; the color may vary 
however. Taking advantage of the fact that the 
font size/style is invariant would seem to be a 
useful thing to do.


The text is not tabular; the starting point for 
each string could be anywhere within the view. We 
could say, for purposes of discussion, that the 
origin for each chunk of text are, in essence, 
random.


Using the NSString convenience functions would 
not seem the best route since the documentation 
says These methods are designed for drawing 
small amounts of text or text that must be drawn 
rarely. They create and dispose of various 
supporting text objects, including 
NSLayoutManager, every time you call them. 
(Reference: 
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextLayout/Tasks/DrawingStrings.html)


Using NSCell seems a good alternative because 
they are lightweight. But in the same document 
cited above, it says for the most efficient 
display of an arbitrary text string, use 
NSLayoutManager directly. But since 
NSLayoutManager seems to want to deal with a 
single NSTextContainer as it's source, this 
somehow doesn't seem to be a good solution for my 
problem.


Any guidance regarding the method that will give 
me the highest performance would be most 
appreciated.


Thanks in advance,
Mark
--
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Performance: Drawing hundreds of short text strings

2010-12-20 Thread Joar Wingfors

On 20 dec 2010, at 01.22, Mark Coniglio wrote:

 My application needs to draw hundreds of short text strings into an NSView. 
 After reviewing the Cocoa documentation on drawing text, I am left unsure as 
 to how to do this with the highest level of efficiency.


Don't optimize in the dark! Implement something in the most straight forward 
way you can imagine, and then measure the performance. If you find that it 
doesn't perform well enough, use your measurements to guide you to a better 
implementation. I don't think that we have enough information yet to provide 
really good suggestions.

Also, hundreds of short text strings doesn't sound all that bad. Will the 
display update a lot (many times per second) or not? If it will need to update, 
will the strings change, or will they just move around?

j o a r


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Performance: Drawing hundreds of short text strings

2010-12-20 Thread Sherm Pendley
On Mon, Dec 20, 2010 at 11:53 PM, Joar Wingfors j...@joar.com wrote:

 On 20 dec 2010, at 01.22, Mark Coniglio wrote:

 My application needs to draw hundreds of short text strings into an NSView. 
 After reviewing the Cocoa documentation on drawing text, I am left unsure as 
 to how to do this with the highest level of efficiency.

 Don't optimize in the dark! Implement something in the most straight forward 
 way you can imagine, and then measure the performance. If you find that it 
 doesn't perform well enough, use your measurements to guide you to a better 
 implementation. I don't think that we have enough information yet to provide 
 really good suggestions.

Seconded. The NSString convenience methods are the easiest, most
straightforward way, so I'd try those first. If and only if they
didn't perform well enough, then I'd start looking for a
better-performing alternative.

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com