Re: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford

On Dec 7, 2009, at 7:08 pm, Chunk 1978 wrote:

 is this suppose to work for multiple touches where one touch is
 already present, then another touches the screen?
 

Yes, it does; tested in a working application.

 it's not working for me.  each time i touch the screen and add an object to 
 the
 myTouches array the return count always returns 1, no matter how many
 fingers i already have touching the screen.
 
Then despite your original assertion, it is likely that you haven't set 
multipleTouchEnabled on your view.

mmalc

___

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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford

On Dec 8, 2009, at 12:38 am, mmalc Crawford wrote:

 is this suppose to work for multiple touches where one touch is
 already present, then another touches the screen?
 
 Yes, it does; tested in a working application.
 
 it's not working for me.  each time i touch the screen and add an object to 
 the
 myTouches array the return count always returns 1, no matter how many
 fingers i already have touching the screen.
 
 Then despite your original assertion, it is likely that you haven't set 
 multipleTouchEnabled on your view.
 
I misread the reply.

Per the documentation for touchesBegan:withEvent:, 
touches
A set of UITouch instances that represent the touches for the starting phase of 
the event represented by event.
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/touchesBegan:withEvent:
(see also 
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/EventHandling/EventHandling.html#//apple_ref/doc/uid/TP40007072-CH9-SW15).

If you already have one finger touching the screen, and you add another, then 
'touches' will only contain one touch.
If you want the coordinates of all the current touches that happen to be 
present when another touch is added, then you need to get allTouches from the 
event.

mmalc

___

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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread Chunk 1978
thanks for the links.  i'm really surprised with how complicated this
is.  i'm also equally surprised that there is not a lot of small
sample code online

On Tue, Dec 8, 2009 at 3:50 AM, mmalc Crawford mmalc_li...@me.com wrote:

 On Dec 8, 2009, at 12:38 am, mmalc Crawford wrote:

 is this suppose to work for multiple touches where one touch is
 already present, then another touches the screen?

 Yes, it does; tested in a working application.

 it's not working for me.  each time i touch the screen and add an object to 
 the
 myTouches array the return count always returns 1, no matter how many
 fingers i already have touching the screen.

 Then despite your original assertion, it is likely that you haven't set 
 multipleTouchEnabled on your view.

 I misread the reply.

 Per the documentation for touchesBegan:withEvent:,
 touches
 A set of UITouch instances that represent the touches for the starting phase 
 of the event represented by event.
 http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/touchesBegan:withEvent:
 (see also 
 http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/EventHandling/EventHandling.html#//apple_ref/doc/uid/TP40007072-CH9-SW15).

 If you already have one finger touching the screen, and you add another, then 
 'touches' will only contain one touch.
 If you want the coordinates of all the current touches that happen to be 
 present when another touch is added, then you need to get allTouches from the 
 event.

 mmalc

 ___

 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/chunk1978%40gmail.com

 This email sent to chunk1...@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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread Graham Cox

On 08/12/2009, at 8:58 PM, Chunk 1978 wrote:

   i'm really surprised with how complicated this
 is.


Yes, because a multi-touch gesture-based events system is child's play, really. 
Makes you wonder why Apple's OS is the only one to have it built in, since any 
half-decent programmer could just knock one off before breakfast and give 
themselves the rest of the day off.

--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


NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread Dalmazio Brisinda
I'm writing a QuickLook plugin that, as part of the preview process, makes an 
http call to a (localhost) server to obtain data that is then used to generate 
the preview image.

The code below works fine outside the QuickLook architecture, as a standard 
Cocoa application. But as soon as I move the (exact) same code over to the 
QuickLook plugin, a call to the server only returns (null) response, and (null) 
data. The docs indicate that this means the connection is failing. But why o 
why is it failing?

If I print the contents of the NSError object to the console, I get the 
following message:

09-12-08 3:02:05 AM quicklookd[37158]   error: Error 
Domain=NSPOSIXErrorDomain Code=1 UserInfo=0x10049d880 The operation couldn’t 
be completed. Operation not permitted

It appears that sendSynchronousRequest:... is not permitted. So why is this 
operation not permitted? And is there a workaround? Any help would be most 
appreciated.

NSURL * url = [NSURL URLWithString:urlString];
NSMutableURLRequest * request = [NSMutableURLRequest 
requestWithURL:url];

[request setHTTPMethod:@POST];
[request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
[request setTimeoutInterval:5];

NSError * error;
NSURLResponse * response;   
NSData * data = [NSURLConnection sendSynchronousRequest:request 
returningResponse:response error:error];

Best,
Dalmazio

___

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: NSDecimal chokes on very small numbers

2009-12-08 Thread Tom Bernard
My work with NSDecimal values has turned up several bugs and a documentation
error. Most of these bugs are extant under Mac OS X 10.5.7, and are FIXED
under Mac OS X 10.6 (10A380).

For the record:

 All bugs are extant under Mac OS X 10.5.7
 

 Extant under Mac OS X 10.6 (10A380):

 NSDecimalPower() chokes on small numbers
 NSDecimalIsNotANumber() incorrect documentation
 

 FIXED under Mac OS X 10.6 (10A380):
 
 NSDecimalAdd() bug
 NSDecimalSubtract() bug
 NSDecimalCompare() bug
 NSDecimalNormalize() drops very small fraction


NSDecimalAdd() and NSDecimalSubtract() return incorrect results when adding
or subtracting a very small number to or from a larger number.

NSDecimalCompare() incorrectly compared NSDecimal one with NSDecimal
1+1e-34, returning NSOrderedSame when NSOrderedAscending was expected.

NSDecimalNormalize() normalized 1+1e-34 to 1.0 .

These issues are extant under Mac OS X 10.5.7 and FIXED under Mac OS X 10.6
(10A380)

Not fixed is the NSDecimalPower() bug already noted. Also, the documentation
for NSDecimalIsNotANumber() has the return values YES and NO reversed.

Bug reports:

NSDecimalPower():  7452166
NSDecimalIsNotANumber() documentation:  7452179


Tom Bernard
tombern...@bersearch.com



on 11/21/09 7:41 AM, Tom Bernard wrote:

 Before reporting this as a bug to Apple's Bug Reporter, I would like
 feedback from the community. I am working in Leopard. Has this been fixed in
 Snow Leopard? Is there something else I am overlooking?
 
 NSDecimalPower returns an unexpected result when I raise 1e-35 to the 4th
 power. I understand that the result is too small to be supported by
 NSDecimal. The returned result:
 
 100\
 00 and err = NSCalculationNoError
 
  does not make sense to me. I was expecting a return of 0 and an err =
 NSCalculationLossOfPrecision.
 
  
 To reproduce:
 
 1) create a new Foundation Tool and implement the following code:
 
 #import Foundation/Foundation.h
 
 #define NSDStr(x) NSDecimalString(x, nil)
 
 
 int main (int argc, const char * argv[]) {
 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
 NSCalculationErrorerr;
 
 // NSDecimalPower bug
 // pow(0.1, 4);
 // result is less than minimum NSDecimal; NSDecimalPower should return 0
 with err = NSCalculationLossOfPrecision
 // (NSCalculationOverflow, NSCalculationUnderflow also understandable)
 //
 // instead returns
 1000
 0
 // with err = NSCalculationNoError
 
 NSDecimaloneEminusThirtyFive, oneEminusThirtyFiveToFourthPower;
 NSString*oneEminusThirtyFiveStr,
 *oneEminusThirtyFiveToFourthPowerStr;
 NSUIntegern;
 
 n = 4;
 oneEminusThirtyFive =[[NSDecimalNumber decimalNumberWithMantissa:1
 exponent:-35 isNegative:NO] decimalValue];
 err =
 NSDecimalPower(oneEminusThirtyFiveToFourthPower, oneEminusThirtyFive, n,
 NSRoundPlain);
 
 oneEminusThirtyFiveStr =NSDStr(oneEminusThirtyFive);
 oneEminusThirtyFiveToFourthPowerStr =
 NSDStr(oneEminusThirtyFiveToFourthPower);
 
 printf(oneEminusThirtyFive = %s\n,
 [oneEminusThirtyFiveStr UTF8String]);
 printf(oneEminusThirtyFiveToFourthPower = %s\n,
 [oneEminusThirtyFiveToFourthPowerStr UTF8String]);
 printf(err = %u\n,err);
 printf(\n);
 
 
 [pool drain];
 return 0;
 }
 
 
 The above code outputs:
 
 oneEminusThirtyFive = 0.001
 oneEminusThirtyFiveToFourthPower =
 1000
 0
 err = 0


___

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


Binding and Observers

2009-12-08 Thread Gerriet M. Denkmann

I have a document based app.
MyDocument.h has:
IBOutletIKImageView *myIkView;

MyDocument.nib has an IKImageView  and an NSSlider with it's value bound to 
myIkView.rotationAngle.

Works perfectly.

But when I closed the window I got an exception complaining about some 
observers not beeing removed.
So I added:

- (void)windowWillClose:(NSNotification *)notification
{
id f = [ ikView observationInfo ];
NSString *oi = [ f description ];

BOOL ok;
NSString *obs = @Observer:;
NSString *kpa = @Key path:;
unsigned long long uuu;
NSString *keyPath1;

NSScanner *u = [ NSScanner scannerWithString: oi ];
[ u setCharactersToBeSkipped: [ NSCharacterSet 
whitespaceAndNewlineCharacterSet ] ];

ok = [ u scanUpToString: obs intoString: NULL ];
ok = [ u scanString: obs intoString: NULL ];
ok = [ u scanHexLongLong: uuu ];
ok = [ u scanUpToString: kpa intoString: NULL ];
ok = [ u scanString: kpa intoString: NULL ];
ok = [ u scanUpToString: @, intoString: keyPath1 ];
[ myIkView removeObserver: (id)uuu  forKeyPath: keyPath1 ];
}

I have some nagging feeling that this is NOT the most straightforward way to 
get rid of this exception.

But:
After windowWillClose: has successfully finished without any exceptions I get 
an EXC_BAD_ACCESS which I don't know what to do about:

#0  0x7fff83d6311c in objc_msgSend ()
#1  0x7fff886d150e in -[NSKeyValueNestedProperty 
object:didRemoveObservance:recurse:] ()
#2  0x7fff886d0d47 in -[NSObject(NSKeyValueObserverRegistration) 
_removeObserver:forProperty:] ()
#3  0x7fff886d0c2b in -[NSObject(NSKeyValueObserverRegistration) 
removeObserver:forKeyPath:] ()
#4  0x7fff83fd02e4 in -[NSBinder _updateObservingRegistration:] ()
#5  0x7fff841c09a8 in -[NSBinder 
releaseConnectionWithSynchronizePeerBinders:] ()
#6  0x7fff845964bd in -[NSValueBinder 
releaseConnectionWithSynchronizePeerBinders:] ()
#7  0x7fff83faf556 in -[NSObject(_NSBindingAdaptorAccess) 
_releaseBindingAdaptor] ()
#8  0x7fff8400798b in -[NSView _releaseBindingAdaptor] ()
#9  0x7fff84006e09 in -[NSView _finalizeWithReferenceCounting] ()
#10 0x7fff840064fc in -[NSView dealloc] ()
#11 0x7fff840cef4f in -[NSControl dealloc] ()
#12 0x7fff8560d246 in _CFAutoreleasePoolPop ()
#13 0x7fff886d62f8 in -[NSAutoreleasePool drain] ()
#14 0x7fff83fa27db in -[NSApplication run] ()
#15 0x7fff83f9b468 in NSApplicationMain ()
#16 0x0001297e in main (argc=1, argv=0x7fff5fbff588) at 
/Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/iMatsch Viewer/main.m:13


Obviously I am missing something fundamental how to properly close a window.
Any help much appreciated.

10.6.2;  garbage collection unsupported.


Kind regards,

Gerriet.


___

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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread Chunk 1978
i meant that i find it complicated compared to basic single touches or
gestures.  it's making my head swim.  since it's something i would
imagine lots of developers have to deal with i'm mostly surprised that
apple hasn't made the process more convenient, but instead the docs
state that i have to use core foundation dictionary to pull this
off...  i mean, certainly i'm not the sharpest developer around, and
for all i know it may be impossible to make the process more
convenient, but that's the element of surprise for you.

On Tue, Dec 8, 2009 at 5:11 AM, Graham Cox graham@bigpond.com wrote:

 On 08/12/2009, at 8:58 PM, Chunk 1978 wrote:

   i'm really surprised with how complicated this
 is.


 Yes, because a multi-touch gesture-based events system is child's play, 
 really. Makes you wonder why Apple's OS is the only one to have it built in, 
 since any half-decent programmer could just knock one off before breakfast 
 and give themselves the rest of the day off.

 --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: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread Mike Abdullah
I'm pretty certain Apple disallows use of non-file URLs in Quick Look 
generators for the simple reason that a generator should run as quickly as 
possible. Generators should also be fairly standalone - why do you need to POST 
to generate a preview/thumbnail?

On 8 Dec 2009, at 10:13, Dalmazio Brisinda wrote:

 I'm writing a QuickLook plugin that, as part of the preview process, makes an 
 http call to a (localhost) server to obtain data that is then used to 
 generate the preview image.
 
 The code below works fine outside the QuickLook architecture, as a standard 
 Cocoa application. But as soon as I move the (exact) same code over to the 
 QuickLook plugin, a call to the server only returns (null) response, and 
 (null) data. The docs indicate that this means the connection is failing. But 
 why o why is it failing?
 
 If I print the contents of the NSError object to the console, I get the 
 following message:
 
 09-12-08 3:02:05 AM   quicklookd[37158]   error: Error 
 Domain=NSPOSIXErrorDomain Code=1 UserInfo=0x10049d880 The operation couldn’t 
 be completed. Operation not permitted
 
 It appears that sendSynchronousRequest:... is not permitted. So why is this 
 operation not permitted? And is there a workaround? Any help would be most 
 appreciated.
 
   NSURL * url = [NSURL URLWithString:urlString];
   NSMutableURLRequest * request = [NSMutableURLRequest 
 requestWithURL:url];
 
   [request setHTTPMethod:@POST];
   [request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
   [request setTimeoutInterval:5];
   
   NSError * error;
   NSURLResponse * response;   
   NSData * data = [NSURLConnection sendSynchronousRequest:request 
   returningResponse:response error:error];
 
 Best,
 Dalmazio
 
 ___
 
 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: IKImageBrowserView image quality changing with redraw

2009-12-08 Thread Mike Abdullah

On 8 Dec 2009, at 00:01, Adam Berger wrote:

 I'm trying to move from a custom view to an IKImageBrowserView in a project,
 and running into a somewhat odd problem. Context: my IKImageBrowserItems are
 IKImageBrowserNSImageRepresentationType, backed by a relatively
 large (~600x800) NSImage.
 
 When first drawn, at any scale factor, this looks great. However, as soon as
 a redraw (not a reload!) occurs, the quality goes to hell. For example,
 clicking in the browserview will cause this problem instantly. It's as if
 it's deciding all of a sudden to fall back to a cached image of much lower
 quality. Scrolling seems not to trigger a redraw of this type; so if a large
 view containing as-first-drawn high quality images is clicked, only the
 currently visible thumbnails will get degraded, and scrolling can then
 present a mix of degraded and full-quality images.
 
 Needless to say, this huge a reduction in image quality is not acceptable.
 How can this be prevented?
 
 [Side note: I've seen reference to the prefetching behavior
 of IKImageBrowserView is particularly gnarly for NSImages as all the preload
 must be done on main thread since NSImage is not thread safe. With this in
 mind, what's the preferred type for IKImageBrowserItem backings?]

NSImage is threadsafe as long as you're not mutating it.

http://developer.apple.com/mac/library/releasenotes/cocoa/AppKit.html
NSImage: Clarifying the contract for 
threading___

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: NSOutlineView expand-by-default with NSTreeController

2009-12-08 Thread Benjamin Rister
On Dec 5, 2009, at 6:11 PM, Jason Foreman wrote:

   [[treeController arrangedObjects] childNodes];
 
 Iterate over this collection and find nodes where [node representedObject] is 
 equal to your newly inserted objects.  Then you can pass this NSTreeNode 
 instance to -[NSOutlineView exandItem:].
 
 This isn't terribly clean, and it might fall down if you have a large number 
 of items in your tree controller, but it works for what I need and might work 
 for you.

Thanks, Jason.

Unfortunately, the content can still be fairly large, so I’m not sure about how 
the performance of a brute force method like this will be. On the other hand, 
premature optimization is the root of all evil, and this is really easy to 
implement. It might not be a bad idea to just do this for now, don’t worry 
about the inefficiency, see how it works for the content sizes that a human 
could deal with, and just revisit the question if it ends up being a practical 
problem.

So if anybody has a cleaner solution (which I’m guessing by the silence they 
don’t), I’m all ears. Otherwise I’ll try this, and just fall back to rewriting 
NSTreeController myself if the performance doesn’t work out. (Is there any open 
source NSTreeController reimplementation out there?)

Best,
Benjamin Rister___

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


Unable to write in InfoPlist.strings file from cpp

2009-12-08 Thread Parimal Das
Hi

I am trying to write CFBundleGetInfoString into InfoPlist.strings from
cpp code and It is writing successfully.
But when i use the InfoPlist.strings in xcode, it gives me a build error
/usr/bin/iconv: English.lproj/InfoPlist.strings:1:82: incomplete character
or shift sequence

Now if i open the .strings file in dashcode (or any other text editor), it
shows me the required text correctly, but when i open the same in xcode - it
show something similar to chinese/japanese script.

Dashcode shows: CFBundleGetInfoString = bla bla bla;
Xcode shows: 屲屮䍆䉵湤汥䝥瑉湦潓瑲楮朠㴠≍慩求牯睳敲′⸳⁐䕎呁Ⱐ䍯

Any idea what is happening here??

Advance thanks.
-Parimal Das
___

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: IKImageBrowserView image quality changing with redraw

2009-12-08 Thread Thomas Goossens
Hi Adam,

Is this on Leopard or Snowleopard ?
I just tried to load images from /System/Library/Desktop Pictures in an 
IKImageBrowserView using the NSImage representation. They appears just fine for 
me (SnowLeopard).

 [Side note: I've seen reference to the prefetching behavior
 of IKImageBrowserView is particularly gnarly for NSImages as all the preload
 must be done on main thread since NSImage is not thread safe. ?]

This is true on Leopard, but not on SnowLeopard.

 With this in
 mind, what's the preferred type for IKImageBrowserItem backings

If you images exists on the filesystem, it is preferable to use a path or url 
based representation.
Otherwise, there is no preferred representation.

-- Thomas


On Dec 8, 2009, at 1:01 AM, Adam Berger wrote:

 I'm trying to move from a custom view to an IKImageBrowserView in a project,
 and running into a somewhat odd problem. Context: my IKImageBrowserItems are
 IKImageBrowserNSImageRepresentationType, backed by a relatively
 large (~600x800) NSImage.
 
 When first drawn, at any scale factor, this looks great. However, as soon as
 a redraw (not a reload!) occurs, the quality goes to hell. For example,
 clicking in the browserview will cause this problem instantly. It's as if
 it's deciding all of a sudden to fall back to a cached image of much lower
 quality. Scrolling seems not to trigger a redraw of this type; so if a large
 view containing as-first-drawn high quality images is clicked, only the
 currently visible thumbnails will get degraded, and scrolling can then
 present a mix of degraded and full-quality images.
 
 Needless to say, this huge a reduction in image quality is not acceptable.
 How can this be prevented?
 
 [Side note: I've seen reference to the prefetching behavior
 of IKImageBrowserView is particularly gnarly for NSImages as all the preload
 must be done on main thread since NSImage is not thread safe. With this in
 mind, what's the preferred type for IKImageBrowserItem backings?]
 
 Adam
 ___
 
 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/tgoossens%40mac.com
 
 This email sent to tgooss...@mac.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: Unable to write in InfoPlist.strings file from cpp

2009-12-08 Thread Greg Parker
On Dec 8, 2009, at 5:25 AM, Parimal Das wrote:
 I am trying to write CFBundleGetInfoString into InfoPlist.strings from
 cpp code and It is writing successfully.
 But when i use the InfoPlist.strings in xcode, it gives me a build error
 /usr/bin/iconv: English.lproj/InfoPlist.strings:1:82: incomplete character
 or shift sequence
 
 Now if i open the .strings file in dashcode (or any other text editor), it
 shows me the required text correctly, but when i open the same in xcode - it
 show something similar to chinese/japanese script.
 
 Dashcode shows: CFBundleGetInfoString = bla bla bla;
 Xcode shows: 屲屮䍆䉵湤汥䝥瑉湦潓瑲楮朠㴠≍慩求牯睳敲′⸳⁐䕎呁Ⱐ䍯

Xcode is probably reading InfoPlist.strings with the wrong text encoding. Most 
likely, your code wrote UTF-8 that Xcode is reading as UTF-16.

Open your project in Xcode, Get Info on each InfoPlist.strings file, and set 
General  File Encoding to the encoding your code writes. When Xcode asks what 
to do with the existing file, choose Reinterpret.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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


Informations about Cocoa implementations of VDCP and MOS protocols

2009-12-08 Thread Mario Kušnjer

Hello to the list !

I'm wondering if anyone here ever came across of Cocoa or Objective-C  
implementations of VDCP and MOS protocols ?
Google shows no results that would give me any references and examples  
about how could (should) this be done.

I guess that nobody tried to make an open source version yet.
There are companies that have their proprietary implementations but ...
So, I would very much appreciate if anyone have any kind of  
documentation (beside official MOS protocol from their website),
references (websites), examples or anything that could help me  
learning how to implement these protocols in my Cocoa application.

Thanks in advance.
Bye

Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

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


Slow performance of adding MIDI Events to MusicTrack?

2009-12-08 Thread NickK
Hi all,
I've been working on a MIDI application and I'm just creating a test track of 
10,000,000 events spread over 46 notes. Once created the application stores the 
MusicSequence as a file. I traditionally use large data sets to ensure the 
applications are written to deliver fast processing and I've done it this time 
to ensure latency is kept to a minimum for MIDI.

The problem I have is that the MusicTrackNewMIDINoteEvent method is 
exceptionally slow - in the order of 30 minutes for adding 100,000 events. All 
the program is doing is 10M loops of adding note events into the MusicTrack.

I've sampled the application running and it spends 100% of it's time within 
std::vector operations - iterator and copy. So I'm assuming it adds the event 
by iterating through the entire current set until it finds the correct 
timestamp location and then makes a gap my copying the data before inserting it.

It seems a little barking mad for Apple to use a linear search routine and I 
would suspect a hashed based dense key storage system would have been better? 
This would slow down with more additions!

Is this a known issue that others have experienced?

I'm using SL, with the compilation running Release x86_64 in addition to 
auto-vec  SSE optimisations on a MBP3,1 2.4GHz with 4GB.

Warmest regards,
Nick.___

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: Slow performance of adding MIDI Events to MusicTrack?

2009-12-08 Thread Simone Tellini

NickK ha scritto:

I've sampled the application running and it spends 100% of it's time within 
std::vector operations - iterator and copy. So I'm assuming it adds the event 
by iterating through the entire current set until it finds the correct 
timestamp location and then makes a gap my copying the data before inserting it.

It seems a little barking mad for Apple to use a linear search routine and I 
would suspect a hashed based dense key storage system would have been better? 
This would slow down with more additions!

Is this a known issue that others have experienced?
  

yes, I've noticed the same thing.

Luckily, I've never had to add that many events/notes, so I could bear 
to wait for some seconds.


--
Simone Tellini
http://www.tellini.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: Slow performance of adding MIDI Events to MusicTrack?

2009-12-08 Thread NickK
Ok, I've submitted it as a performance bug to Apple. It's a quick win fix to be 
honest with a large effect on their MIDI users.

I should try a test using MIDIEndPoint attached to the MusicTrack to add the 
note events instead..

Nick

On 8 Dec 2009, at 14:59, Simone Tellini wrote:

 NickK ha scritto:
 I've sampled the application running and it spends 100% of it's time within 
 std::vector operations - iterator and copy. So I'm assuming it adds the 
 event by iterating through the entire current set until it finds the correct 
 timestamp location and then makes a gap my copying the data before inserting 
 it.
 
 It seems a little barking mad for Apple to use a linear search routine and I 
 would suspect a hashed based dense key storage system would have been 
 better? This would slow down with more additions!
 
 Is this a known issue that others have experienced?
  
 yes, I've noticed the same thing.
 
 Luckily, I've never had to add that many events/notes, so I could bear to 
 wait for some seconds.
 
 -- 
 Simone Tellini
 http://www.tellini.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/cocoadev%40adrenalin-junkie.net
 
 This email sent to cocoa...@adrenalin-junkie.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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford

On Dec 8, 2009, at 3:49 am, Chunk 1978 wrote:

 i meant that i find it complicated compared to basic single touches or
 gestures.
 
It's not clear what's complicated.

You typically want to know when touches began, moved, and ended, and there are 
methods to inform you when each of these things happen (and another to let you 
know that they've been interrupted).

This is a multi-touch system, so just because one touch began it doesn't mean 
all did.  So in some cases at least (including, it seems, yours) you need a 
means to get information about other touches.  The methods therefore all tell 
you: Here are the touches that have just entered the phase you're interested 
in in this method, and here's a data structure (the UIEvent object) that gives 
you a way to get information about all the current touches.

It's difficult to see how this could be simpler.  About the only simplification 
could be that the methods could take a single parameter... there are a couple 
of scenarios for this.  The methods could just pass the UIEvent object -- but 
then you'd have to iterate through its touches to find the ones that are in the 
phase you're interested in.  Or you could have two (or three) methods per 
phase, e.g. touchesBegan: and touchesBeganInEvent: (and maybe again 
touchesBegan:withEvent:), but then you're making things more complicated again 
with multiple override points.

mmalc

___

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


File system file renaming question...

2009-12-08 Thread Phil Hystad
This question is not specifically about Cocoa programming but I hope that some 
Mac OS X experts out there can give me an answer.

I sent an attached photo to my daughter so that she could print it out using 
Costco print services.  I sent it at high resolution, the photo image was 1.6 
MB.  It seems that Mac mail changed the resolution to a more web friendly size 
of about 64 K with much reduced resolution.  So, I thought that a way to get 
around this was to change the file type (extension) of the image file to 
something other then .jpg such as .dat (and, I tried .zz, .q, and null).  
However, the file was still recognized and interpreted as a jpeg file and 
treated in the same manner by mail (and, also by the finder that displayed the 
image).

So, it looks like Mac OS X is interpreting the file based on contents and not 
based on file extension.  This seems to be a very wrong thing to do in my 
opinion.  Does anyone know of a way to turn this off or is this considered a 
feature for some ease-of-use aspect of OS 
X?___

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: odd problems with NSData / OpenGL

2009-12-08 Thread David Duncan
On Dec 7, 2009, at 11:46 PM, Henri Häkkinen wrote:

 I have a simple Cocoa document-based application, which uses a custom 
 NSOpenGLView derived class. This view object has a reference to the document 
 object (this binding is set in the nib file), and the document has a 
 reference to a Mesh class. Mesh loads vertices and indexed triangular faces 
 from a file, and stores them as NSData objects containing vertex arrays, 
 intended to be used with glVertexPointer etc. OpenGL calls.
 
 The mesh is drawn in drawRect: of the view class using OpenGL. First call of 
 this method works fine and the mesh is rendered. However, after calling 
 setNeedsDisplay (for example in reshape method or anywhere) the program 
 crashes with EXC_BAD_ACCESS when the drawRect method is trying to access the 
 NSData objects of the mesh. Using the debugger I can see that the pointers 
 (both the document reference, mesh reference and the NSData pointers inside 
 the mesh) remain the same between the calls of drawRect:, as in nothing seems 
 to get overwritten accidentally or anything.


More than likely this is a memory management problem. Specifically, you 
probably aren't claiming ownership of the NSData object that you store in your 
instance variable, and thus it is being deallocated out from under you.
--
David Duncan
Apple DTS Animation and Printing

___

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 system file renaming question...

2009-12-08 Thread Jens Miltner


Am 08.12.2009 um 17:26 schrieb Phil Hystad:

This question is not specifically about Cocoa programming but I hope  
that some Mac OS X experts out there can give me an answer.


I sent an attached photo to my daughter so that she could print it  
out using Costco print services.  I sent it at high resolution, the  
photo image was 1.6 MB.  It seems that Mac mail changed the  
resolution to a more web friendly size of about 64 K with much  
reduced resolution.  So, I thought that a way to get around this was  
to change the file type (extension) of the image file to something  
other then .jpg such as .dat (and, I tried .zz, .q, and null).   
However, the file was still recognized and interpreted as a jpeg  
file and treated in the same manner by mail (and, also by the finder  
that displayed the image).


So, it looks like Mac OS X is interpreting the file based on  
contents and not based on file extension.  This seems to be a very  
wrong thing to do in my opinion.


Why exactly does this seem very wrong? After all, it's the content  
that matters, not the file name or extension... A picture is a picture  
and won't become a text document or a sound just because you change  
the extension!



 Does anyone know of a way to turn this off or is this considered a  
feature for some ease-of-use aspect of OS X?


When you add pictures to a mail message in Apple Mail, there's a  
little popup menu in the lower right corner of the mail message window  
that allows you to pick the image size. IIRC, one entry is Original  
size...


/jum

___

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: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread David Duncan
On Dec 8, 2009, at 2:13 AM, Dalmazio Brisinda wrote:

 I'm writing a QuickLook plugin that, as part of the preview process, makes an 
 http call to a (localhost) server to obtain data that is then used to 
 generate the preview image.
 
 The code below works fine outside the QuickLook architecture, as a standard 
 Cocoa application. But as soon as I move the (exact) same code over to the 
 QuickLook plugin, a call to the server only returns (null) response, and 
 (null) data. The docs indicate that this means the connection is failing. But 
 why o why is it failing?


My understanding is Quicklook plugins are not allowed to make network 
connections due to sandbox restrictions.
--
David Duncan
Apple DTS Animation and Printing

___

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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread Chunk 1978
this is what i have so far, but i have no idea how to write the
touchesEnded method so that the appropriate label will clear.  so if 3
fingers are touching the screen and displaying their different
coordinates, if the 2nd finger that was pressed ends its touch, the
2nd label will clear (Touch 2: {0, 0}) while the 1st and 3rd
continue to track.  clearly i'm lost, i apologize.

- (void)viewDidLoad
       {
       labelsArray = [[NSArray alloc] initWithObjects:touchLabe1,
touchLabe2, touchLabe3, nil];
       touchesArray = [[NSMutableArray alloc] initWithCapacity:3];
       }

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
       {
       for (UITouch *touch in touches)
               [touchesArray addObject:touch];

       for (NSUInteger i = 0; i  3; i++)
               {
               UILabel *aLabel = [labelsArray objectAtIndex:i];
               if (i  [touchesArray count])
                       {
                       UITouch *touch = [touchesArray objectAtIndex:i];
                       NSString *point = NSStringFromCGPoint([touch
locationInView:self.view]);
                       aLabel.text = [NSString
stringWithFormat:@Title %i:\n%@, i+1, point];
                       }
               }
       }

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
       {
       for (NSUInteger i = 0; i  3; i++)
               {
               UILabel *aLabel = [labelsArray objectAtIndex:i];
               if (i  [touchesArray count])
                       {
                       UITouch *touch = [touchesArray objectAtIndex:i];
                       NSString *point = NSStringFromCGPoint([touch
locationInView:self.view]);
                       aLabel.text = [NSString
stringWithFormat:@Title %i:\n%@, i+1, point];
                       }
               }
       }

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
       {
       //??
       }



On Tue, Dec 8, 2009 at 11:01 AM, mmalc Crawford mmalc_li...@me.com wrote:

 On Dec 8, 2009, at 3:49 am, Chunk 1978 wrote:

 i meant that i find it complicated compared to basic single touches or
 gestures.

 It's not clear what's complicated.

 You typically want to know when touches began, moved, and ended, and there 
 are methods to inform you when each of these things happen (and another to 
 let you know that they've been interrupted).

 This is a multi-touch system, so just because one touch began it doesn't mean 
 all did.  So in some cases at least (including, it seems, yours) you need a 
 means to get information about other touches.  The methods therefore all tell 
 you: Here are the touches that have just entered the phase you're interested 
 in in this method, and here's a data structure (the UIEvent object) that 
 gives you a way to get information about all the current touches.

 It's difficult to see how this could be simpler.  About the only 
 simplification could be that the methods could take a single parameter... 
 there are a couple of scenarios for this.  The methods could just pass the 
 UIEvent object -- but then you'd have to iterate through its touches to find 
 the ones that are in the phase you're interested in.  Or you could have two 
 (or three) methods per phase, e.g. touchesBegan: and touchesBeganInEvent: 
 (and maybe again touchesBegan:withEvent:), but then you're making things more 
 complicated again with multiple override points.

 mmalc

 ___

 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/chunk1978%40gmail.com

 This email sent to chunk1...@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


Big memory/time consumption in NSTreeController KVO GC

2009-12-08 Thread Benjamin Rister
I have a NSTreeController displayed via an NSOutlineView. It’s set up to expand 
items by default as they’re added to the model. This is all on Snow Leopard.

When a bunch of items (some thousands) are added and removed from the model, 
there’s a large memory spike (multi-hundred MB) almost entirely of Malloc 16.50 
KB blocks, and the bulk of the CPU time is being spent in libauto.

The stack trace of most of the memory allocations is:
  ...
  12 libSystem.B.dylib _dispatch_call_block_and_release
  11 libauto.dylib auto_collection_work(Auto::Zone*)
  10 libauto.dylib auto_collect_internal(Auto::Zone*, unsigned int)
   9 libauto.dylib Auto::Zone::collect(bool, void*, unsigned long long*)
   8 libauto.dylib weak_call_callbacks
   7 Foundation NSKeyValueObservanceBecameUseless
   6 Foundation _NSKeyValueRemoveUselessObservances
   5 Foundation _NSKeyValueObservationInfoCreateByCollecting
   4 Foundation -[NSKeyValueObservationInfo _initWithObservances:count:]
   3 Foundation -[NSConcretePointerArray addPointer:]
   2 libauto.dylib auto_assign_weak_reference
   1 libauto.dylib weak_register
   0 libauto.dylib append_referrer_no_lock(weak_referrer_array_t*, void**, 
auto_weak_callback_block*)

Almost all of the rest are:
  ...
  21 MyProject -[MyModelObject addChild:]
  20 Foundation NSKVOInsertObjectAtIndexAndNotify
  19 Foundation -[NSObject(NSKeyValueObserverNotification) 
didChange:valuesAtIndexes:forKey:]
  18 Foundation NSKeyValueDidChange
  17 AppKit -[NSTreeControllerTreeNode 
observeValueForKeyPath:ofObject:change:context:]
  16 AppKit -[NSTreeControllerTreeNode 
updateChildNodesForKeyPath:affectedIndexPaths:]
  15 AppKit -[NSTreeControllerTreeNode 
updateChildNodesForKeyPath:affectedIndexPaths:]
  14 Foundation -[NSObject(NSKeyValueObserverNotification) 
didChangeValueForKey:]
  13 Foundation NSKeyValueDidChange
  12 Foundation -[NSKeyValueNestedProperty 
object:withObservance:didChangeValueForKeyOrKeys:recurse:forwardingValues:]
  11 Foundation -[NSObject(NSKeyValueObserverRegistration) 
addObserver:forKeyPath:options:context:]
  10 Foundation -[NSObject(NSKeyValueObserverRegistration) 
_addObserver:forProperty:options:context:]
   9 Foundation -[NSKeyValueUnnestedProperty object:didAddObservance:recurse:]
   8 Foundation -[NSKeyValueNestedProperty object:didAddObservance:recurse:]
   7 Foundation -[NSObject(NSKeyValueObserverRegistration) 
addObserver:forKeyPath:options:context:]
   6 Foundation -[NSObject(NSKeyValueObserverRegistration) 
_addObserver:forProperty:options:context:]
   5 Foundation _NSKeyValueObservationInfoCreateByAdding
   4 Foundation -[NSKeyValueObservationInfo _initWithObservances:count:]
   3 Foundation -[NSConcretePointerArray addPointer:]
   2 libauto.dylib auto_assign_weak_reference
   1 libauto.dylib weak_register
   0 libauto.dylib append_referrer_no_lock(weak_referrer_array_t*, void**, 
auto_weak_callback_block*)

After every item is eventually removed (aside from one remaining one in the 
root, which was already there at the start), the app is still using 48MB RPRVT. 
This was 6MB at the start of the process, in this same model state as it ended. 
heap -guessNonObjects shows most of the memory as non-objects in dictionaries 
and arrays (e.g. NSCFDictionary[48]), and NSConcretePointerArrays, all in the 
auto zone.

The only references to some of these key function names I could find on the web 
were in the libauto sources, and no mention at all in mailing lists, so it 
doesn’t seem like anybody else has posted about this before.

Any ideas about why NSTreeController’s KVO is taking up so much memory/CPU with 
bookkeeping? Any suggestions for working around the problem?

Thanks,
Benjamin Rister___

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 system file renaming question...

2009-12-08 Thread Alastair Houghton
On 8 Dec 2009, at 16:26, Phil Hystad wrote:

 This question is not specifically about Cocoa programming but I hope that 
 some Mac OS X experts out there can give me an answer.

Then why not send it to an appropriate mailing list, like macosx-talk?  Or post 
it in Apple's voluminous Support forums (which I guess you probably haven't 
searched since you can't be the first person to ask this question).

This list is for Cocoa-related things *only*.  Not for Cocoa questions except 
when you have a non-Cocoa question you think we might be able to answer.

Kind regards,

Alastair.

-- 
http://alastairs-place.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


Customize the line's color that separates the window content from the title bar?

2009-12-08 Thread Michael Abendroth
Hi,

I'd like to customize the color of the line that separates a window's
content area from its title bar. I've uploaded a screenshot of the
line I mean here: http://i48.tinypic.com/r2q9eu.png .

How would I do this, if possible without having to subclass NSWindow?

Thanks,

-Mike
___

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: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread lbland
hi-

On Dec 8, 2009, at 11:48 AM, David Duncan wrote:

 My understanding is Quicklook plugins are not allowed to make network 
 connections due to sandbox restrictions.

We ran into this same problem when QL plugins were first included with the OS.

thanks!-

-lance

___

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 system file renaming question...

2009-12-08 Thread Greg Guerin

Phil Hystad wrote:

Does anyone know of a way to turn this off or is this considered a  
feature for some ease-of-use aspect of OS X?



Compress images to zip before sending?

I've never seen Mail do anything except transfer zips as-is.

  -- GG

___

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


A list for off-topic messages (was Re: File system file renaming question...)

2009-12-08 Thread Randall Meadows
On Dec 8, 2009, at 9:26 AM, Phil Hystad wrote:

 This question is not specifically about Cocoa programming but I hope that 
 some Mac OS X experts out there can give me an answer.

Well, you're probably going to get spanked for doing that.

A very good list for these type of Mac-related, but Cocoa-unrelated questions 
is the Mac-L, Macintosh News and Information mailing list.  Subscribe 
information can be found at http://www.listmoms.net/mac-l/index.html.

I'm posting this back to the list so that folks who are inclined in the future 
to post similar off-topic messages here will have an alternative.

___

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: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread Dalmazio Brisinda
Well, it's the way the system is architected -- we are using QuickLook plugins 
for icon badging, and that badging depends on the state of certain elements of 
the filesystem which is maintained in a separate server process.

sigh

Best,
Dalmazio



On 2009-12-08, at 5:09 AM, Mike Abdullah wrote:

 I'm pretty certain Apple disallows use of non-file URLs in Quick Look 
 generators for the simple reason that a generator should run as quickly as 
 possible. Generators should also be fairly standalone - why do you need to 
 POST to generate a preview/thumbnail?
 
 On 8 Dec 2009, at 10:13, Dalmazio Brisinda wrote:
 
 I'm writing a QuickLook plugin that, as part of the preview process, makes 
 an http call to a (localhost) server to obtain data that is then used to 
 generate the preview image.
 
 The code below works fine outside the QuickLook architecture, as a standard 
 Cocoa application. But as soon as I move the (exact) same code over to the 
 QuickLook plugin, a call to the server only returns (null) response, and 
 (null) data. The docs indicate that this means the connection is failing. 
 But why o why is it failing?
 
 If I print the contents of the NSError object to the console, I get the 
 following message:
 
 09-12-08 3:02:05 AM  quicklookd[37158]   error: Error 
 Domain=NSPOSIXErrorDomain Code=1 UserInfo=0x10049d880 The operation 
 couldn’t be completed. Operation not permitted
 
 It appears that sendSynchronousRequest:... is not permitted. So why is this 
 operation not permitted? And is there a workaround? Any help would be most 
 appreciated.
 
  NSURL * url = [NSURL URLWithString:urlString];
  NSMutableURLRequest * request = [NSMutableURLRequest 
 requestWithURL:url];
 
  [request setHTTPMethod:@POST];
  [request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
  [request setTimeoutInterval:5];
  
  NSError * error;
  NSURLResponse * response;   
  NSData * data = [NSURLConnection sendSynchronousRequest:request 
  returningResponse:response error:error];
 
 Best,
 Dalmazio
 
 ___
 
 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: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread Dalmazio Brisinda
Thanks for that. Okay, I see the QuickLook docs sort of allude to this in 
regards to using Web-Kit plugins within QuickLook generators. Which gets me 
thinking: would it then be possible to maybe connect to the server via local 
distributed objects instead of using the NSURLConnection framework? In 
otherwords, how deep does the sandbox go?

Any ideas on how to possibly bypass this would be most welcome. 

Best,
Dalmazio


On 2009-12-08, at 9:48 AM, David Duncan wrote:

 On Dec 8, 2009, at 2:13 AM, Dalmazio Brisinda wrote:
 
 I'm writing a QuickLook plugin that, as part of the preview process, makes 
 an http call to a (localhost) server to obtain data that is then used to 
 generate the preview image.
 
 The code below works fine outside the QuickLook architecture, as a standard 
 Cocoa application. But as soon as I move the (exact) same code over to the 
 QuickLook plugin, a call to the server only returns (null) response, and 
 (null) data. The docs indicate that this means the connection is failing. 
 But why o why is it failing?
 
 
 My understanding is Quicklook plugins are not allowed to make network 
 connections due to sandbox restrictions.
 --
 David Duncan
 Apple DTS Animation and Printing
 

___

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: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread Kyle Sluder
On Tue, Dec 8, 2009 at 10:13 AM, Dalmazio Brisinda dbrisi...@gmail.com wrote:
 Well, it's the way the system is architected -- we are using QuickLook 
 plugins for icon badging, and that badging depends on the state of certain 
 elements of the filesystem which is maintained in a separate server process.

This seems like a worrisome arrangement.  The Finder's icon cache is
notoriously temperamental.  There is no guarantee about when your
QuickLook generator will be called, so you run the risk of displaying
incorrect information, which is worse than displaying no information
at all.

--Kyle Sluder
___

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: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread David Duncan
On Dec 8, 2009, at 10:16 AM, Dalmazio Brisinda wrote:

 Thanks for that. Okay, I see the QuickLook docs sort of allude to this in 
 regards to using Web-Kit plugins within QuickLook generators. Which gets me 
 thinking: would it then be possible to maybe connect to the server via local 
 distributed objects instead of using the NSURLConnection framework? In 
 otherwords, how deep does the sandbox go?


Sandbox restrictions are process-wide.

 Well, it's the way the system is architected -- we are using QuickLook 
 plugins for icon badging, and that badging depends on the state of certain 
 elements of the filesystem which is maintained in a separate server process.

If the process is local you might try Unix domain sockets.

Overall, you might have a better chance of getting help with this on 
Quicklook-dev, or perhaps Darwin-dev (for the sandboxing stuff).
--
David Duncan
Apple DTS Animation and Printing

___

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: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread Julien Jalon
This discussion would be better done in the quicklook-dev mailing list. And
in fact, it already took place there.
Please avoid cross posting questions like this.

On Tue, Dec 8, 2009 at 7:16 PM, Dalmazio Brisinda dbrisi...@gmail.comwrote:

 Thanks for that. Okay, I see the QuickLook docs sort of allude to this in
 regards to using Web-Kit plugins within QuickLook generators. Which gets me
 thinking: would it then be possible to maybe connect to the server via local
 distributed objects instead of using the NSURLConnection framework? In
 otherwords, how deep does the sandbox go?

 Any ideas on how to possibly bypass this would be most welcome.

 Best,
 Dalmazio


 On 2009-12-08, at 9:48 AM, David Duncan wrote:

  On Dec 8, 2009, at 2:13 AM, Dalmazio Brisinda wrote:
 
  I'm writing a QuickLook plugin that, as part of the preview process,
 makes an http call to a (localhost) server to obtain data that is then used
 to generate the preview image.
 
  The code below works fine outside the QuickLook architecture, as a
 standard Cocoa application. But as soon as I move the (exact) same code over
 to the QuickLook plugin, a call to the server only returns (null) response,
 and (null) data. The docs indicate that this means the connection is
 failing. But why o why is it failing?
 
 
  My understanding is Quicklook plugins are not allowed to make network
 connections due to sandbox restrictions.
  --
  David Duncan
  Apple DTS Animation and Printing
 

 ___

 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/jjalon%40gmail.com

 This email sent to jja...@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: IKImageBrowserView image quality changing with redraw

2009-12-08 Thread Adam Berger
This has so far only been tested on SnowLeopard.

I'm going to divide this into two issues, since I'm not 100% sure they're
related.

1) On redraw, a filtering is applied that changes the image quality. Are you
seeing this change on first redraw from a large NSImage (rather than from a
url to an image)?

2) The filtering applied may actually be appropriate for photographs, but
I'm dealing with line drawings, which become completely unusable when scaled
in this way. Even zero antialiasing would be greatly preferred

3) (Not an issue, but a possible solution that didn't work.) If providing an
NSImage with multiple NSImageReps that only vary in resolution, icon style,
IKImageBrowserView seems to always work with the first/largest. If I could
make this work, I'd just generate multiple thumbnails. (I suppose I could
throw away all thumbnails on bump the version number on scale change...
expensive, though.)

I've put up three screenshots:

• http://www.addaon.com/IKImageBrowserView_scaling_A.png
is a manually-scaled high-quality image (about half the size of the
original; just for comparison)

• http://www.addaon.com/IKImageBrowserView_scaling_B.png
is how it appears initially (before redraw); this is marginally acceptable

• http://www.addaon.com/IKImageBrowserView_scaling_C.png
is the over-filtered form

Again, the transition between B and C happens whenever I cause a redraw, for
example by clicking on the background.

Hard to overstate this problem.

Adam

On Tue, Dec 8, 2009 at 5:59 AM, Thomas Goossens tgooss...@mac.com wrote:

 Hi Adam,

 Is this on Leopard or Snowleopard ?
 I just tried to load images from /System/Library/Desktop Pictures in an
 IKImageBrowserView using the NSImage representation. They appears just fine
 for me (SnowLeopard).

  I'm trying to move from a custom view to an IKImageBrowserView in a
 project,
  and running into a somewhat odd problem. Context: my IKImageBrowserItems
 are
  IKImageBrowserNSImageRepresentationType, backed by a relatively
  large (~600x800) NSImage.
 
  When first drawn, at any scale factor, this looks great. However, as soon
 as
  a redraw (not a reload!) occurs, the quality goes to hell. For example,
  clicking in the browserview will cause this problem instantly. It's as if
  it's deciding all of a sudden to fall back to a cached image of much
 lower
  quality. Scrolling seems not to trigger a redraw of this type; so if a
 large
  view containing as-first-drawn high quality images is clicked, only the
  currently visible thumbnails will get degraded, and scrolling can then
  present a mix of degraded and full-quality images.
 
  Needless to say, this huge a reduction in image quality is not
 acceptable.
  How can this be prevented?

___

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: Localizing Xibs using bindings

2009-12-08 Thread Duccio
Il giorno 05/dic/2009, alle ore 19.05, Rossi Matteo ha scritto:

 I find it very annoying to localize Xibs by keeping a copy for each 
 translation. It's both tedious and error-prone.
 I've found that by simply binding each button's title (or wharever other 
 control you need) to the appropriate key of a NSDictionary object I can 
 easily localize each item.
 No need to create tons of outlets for each control. Indeed I have no outlet 
 at all. It works smoothly and I can send only .strings files to my 
 translators.

Which technique you used to do this (to bind each button's title to a key of a 
NSDictionary without outlets)?


___

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


[iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Duccio
Hi.

I created CustomNavBar subclassing UINavigationBar.

In Interface Builder I drag a Navigation Controller (UINavigationController) 
from the library to the document. Under this object in document window I can 
see a Navigation Bar (UINavigationBar). Clicking it and using the Identity 
Inspector I can change the class from standard UINavigationBar to my 
CustomNavBar.

How can I reproduce it programmatically?

MyViewController *myViewController = [[MyViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] 
initWithRootViewController:myViewController];
[myViewController release];

UINavigationController navigationBar property is read only so I can't do:

CustomNavBar *customNavBar = [[CustomNavBar alloc] init];
navController.navigationBar = customNavBar;
[customNavBar release];

What should I do to customize the navigation bar programmatically? Is IB more 
powerful than code? I believed all that can be done in IB could be done 
also programmatically.

Duccio.

___

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


CAShapeLayer and touches?

2009-12-08 Thread Eric E. Dolecki
I have a CAShapeLayer and I'd like to drag it. I have this code which I
can't configure correctly:

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

UITouch *touch = [[event allTouches] anyObject];
if( CGRectContainsPoint([pointerLayer bounds], [touch
locationInView:pointerLayer] )){

NSLog(@touched the pointer);

}

}

Looks like that method expects a UIView - what's the best way to access the
CAShapeLayer to know whether or not a user's touched it? Then I'd like to
constrain drag it.

Thanks,
Eric
___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Luke the Hiesterman
You could subclass UINavigationController.

Luke

On Dec 8, 2009, at 9:46 AM, Duccio wrote:

 Hi.
 
 I created CustomNavBar subclassing UINavigationBar.
 
 In Interface Builder I drag a Navigation Controller (UINavigationController) 
 from the library to the document. Under this object in document window I can 
 see a Navigation Bar (UINavigationBar). Clicking it and using the Identity 
 Inspector I can change the class from standard UINavigationBar to my 
 CustomNavBar.
 
 How can I reproduce it programmatically?
 
   MyViewController *myViewController = [[MyViewController alloc] init];
   UINavigationController *navController = [[UINavigationController alloc] 
 initWithRootViewController:myViewController];
   [myViewController release];
 
 UINavigationController navigationBar property is read only so I can't do:
 
   CustomNavBar *customNavBar = [[CustomNavBar alloc] init];
   navController.navigationBar = customNavBar;
   [customNavBar release];
 
 What should I do to customize the navigation bar programmatically? Is IB more 
 powerful than code? I believed all that can be done in IB could be done 
 also programmatically.
 
 Duccio.
 
 ___
 
 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/luketheh%40apple.com
 
 This email sent to luket...@apple.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: Big memory/time consumption in NSTreeController KVO GC

2009-12-08 Thread jonat...@mugginsoft.com
 
 
 Any ideas about why NSTreeController’s KVO is taking up so much memory/CPU 
 with bookkeeping? Any suggestions for working around the problem?
 
I assume that you are using bindings. Looks like  a typical KVO notification 
storm to me.
What works well for adding and updating one or two objects can easily turn to 
sludge for larger object numbers as thousands of KVO notifications are sent.
This isn't bookkeeping - its KVO doing what you asked it to do - telling you 
about every change to your model.

Are you adding your nodes to the NSTreeControllers content while bindings are 
active?
If you build your tree separately and then set the NSTreeController 
content/binding then things should improve drastically.

Hope this helps.

Jonathan

 Thanks,
 Benjamin Rister___
 
 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/jonathan%40mugginsoft.com
 
 This email sent to jonat...@mugginsoft.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: Customize the line's color that separates the window content from the title bar?

2009-12-08 Thread Jens Alfke


On Dec 8, 2009, at 9:25 AM, Michael Abendroth wrote:


I'd like to customize the color of the line that separates a window's
content area from its title bar.


Try turning on the textured flag in IB.

—Jens

___

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: Customize the line's color that separates the window content from the title bar?

2009-12-08 Thread Michael Abendroth
On Tue, Dec 8, 2009 at 8:54 PM, Jens Alfke j...@mooseyard.com wrote:

 On Dec 8, 2009, at 9:25 AM, Michael Abendroth wrote:

 I'd like to customize the color of the line that separates a window's
 content area from its title bar.

 Try turning on the textured flag in IB.

 —Jens



Unfortunately, when turning on the textured flag in IB, my app
mysteriously crashes.
___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Aldo Armiento
Il giorno 08/dic/2009, alle ore 20.40, Luke the Hiesterman ha scritto:

 You could subclass UINavigationController.
 

I can't (or I should't):

This class is not intended for subclassing. Instead, you use instances of it 
as-is in situations where you want your application’s user interface to reflect 
the hierarchical nature of your content. (UINavigationController Class 
Reference, Apple)

The question is: why can I use my custom subclass of UINavigationBar in a 
UINavigationController using IB and I can't do it programmatically? All that 
can be done in IB should not be able to do programmatically?

Thanks,

Duccio

 Luke
 
 On Dec 8, 2009, at 9:46 AM, Duccio wrote:
 
 Hi.
 
 I created CustomNavBar subclassing UINavigationBar.
 
 In Interface Builder I drag a Navigation Controller (UINavigationController) 
 from the library to the document. Under this object in document window I can 
 see a Navigation Bar (UINavigationBar). Clicking it and using the Identity 
 Inspector I can change the class from standard UINavigationBar to my 
 CustomNavBar.
 
 How can I reproduce it programmatically?
 
  MyViewController *myViewController = [[MyViewController alloc] init];
  UINavigationController *navController = [[UINavigationController alloc] 
 initWithRootViewController:myViewController];
  [myViewController release];
 
 UINavigationController navigationBar property is read only so I can't do:
 
  CustomNavBar *customNavBar = [[CustomNavBar alloc] init];
  navController.navigationBar = customNavBar;
  [customNavBar release];
 
 What should I do to customize the navigation bar programmatically? Is IB 
 more powerful than code? I believed all that can be done in IB could be 
 done also programmatically.
 
 Duccio.

___

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: CAShapeLayer and touches?

2009-12-08 Thread David Duncan
On Dec 8, 2009, at 11:34 AM, Eric E. Dolecki wrote:

 Looks like that method expects a UIView - what's the best way to access the
 CAShapeLayer to know whether or not a user's touched it? Then I'd like to
 constrain drag it.


Are you trying to hit test against the shape layer's path? I'm not certain that 
is trivial. Does the shape layer have an associated view (i.e. did you subclass 
UIView to override +layerClass)? If so you could use that associated view. 
Otherwise you can use the layer's -hitTest: method to determine which layer was 
hit.
--
David Duncan
Apple DTS Animation and Printing

___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Kyle Sluder
On Tue, Dec 8, 2009 at 12:00 PM, Aldo Armiento lists.ap...@me.com wrote:
 The question is: why can I use my custom subclass of UINavigationBar in a 
 UINavigationController using IB and I can't do it programmatically? All that 
 can be done in IB should not be able to do programmatically?

I guess one question is, why do you want to do this
programmatically?  Prefer IB over writing code.

Though you're right, you should be able to at least specify the class
of navigation bar, if not provide your own instance.

--Kyle Sluder
___

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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford

On Dec 8, 2009, at 8:59 am, Chunk 1978 wrote:

 this is what i have so far, but i have no idea how to write the
 touchesEnded method so that the appropriate label will clear.  so if 3
 fingers are touching the screen and displaying their different
 coordinates, if the 2nd finger that was pressed ends its touch, the
 2nd label will clear (Touch 2: {0, 0}) while the 1st and 3rd
 continue to track.  clearly i'm lost, i apologize.
 [...]
 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches)
[touchesArray addObject:touch];
 
Touches are delivered in mathematical sets; there is no ordering.  It's not 
quite clear what you're trying to achieve by adding the touches to the array, 
but it won't preserve ordering for you over the long term.  A user may make one 
touch, then put down another finger, lift the first, then put down a third 
whilst the second is still on screen.  Is that now touch 1 or touch 3?  (UIKit 
happens to recycle touch objects, but it's not clear if that's the same 
semantic you want.)

(As an aside, note also NSSet's initWithArray: method...)

It's still not clear precisely what you want to achieve (see 
http://catb.org/~esr/faqs/smart-questions.html#goal). Generally, though, you 
seem to want a mapping from a touch to a particular label to display the 
current coordinates, along the lines of the class below...

mmalc



#import UIKit/UIKit.h
#import CoreFoundation/CoreFoundation.h

@interface TouchesView : UIView {

UILabel *touchLabel1;
UILabel *touchLabel2;
UILabel *touchLabel3;
UILabel *touchLabel4;
UILabel *touchLabel5;

CFMutableDictionaryRef touchToLabelMapping;
NSMutableArray *availableLabels;
BOOL setUp;
}

@property (nonatomic, retain) IBOutlet UILabel *touchLabel1;
@property (nonatomic, retain) IBOutlet UILabel *touchLabel2;
@property (nonatomic, retain) IBOutlet UILabel *touchLabel3;
@property (nonatomic, retain) IBOutlet UILabel *touchLabel4;
@property (nonatomic, retain) IBOutlet UILabel *touchLabel5;

@end





@implementation TouchesView

@synthesize touchLabel1, touchLabel2, touchLabel3, touchLabel4, touchLabel5;

- (void)setUpTouchHandling {

touchToLabelMapping = CFDictionaryCreateMutable (kCFAllocatorDefault, 5, 
kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks);
availableLabels = [[NSMutableArray alloc] initWithObjects:touchLabel1, 
touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
}


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

if (!setUp) {
[self setUpTouchHandling];
}

for (UITouch *touch in touches) {
if (touch.view == self) {
UILabel *label = (UILabel *)[availableLabels objectAtIndex:0];
CFDictionaryAddValue (touchToLabelMapping, touch, label);
[availableLabels removeObjectAtIndex:0];
label.text = NSStringFromCGPoint([touch locationInView:self]);
}
}
}


- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

for (UITouch *touch in touches) {
if (touch.view == self) {
UILabel *label = (UILabel 
*)CFDictionaryGetValue(touchToLabelMapping, touch);
label.text = NSStringFromCGPoint([touch locationInView:self]);
}
}
}


- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

for (UITouch *touch in touches) {
if (touch.view == self) {
UILabel *label = (UILabel 
*)CFDictionaryGetValue(touchToLabelMapping, touch);
label.text = @{0, 0};
CFDictionaryRemoveValue (touchToLabelMapping, touch);
[availableLabels addObject:label];
}
}
}


- (void)dealloc {

CFRelease(touchToLabelMapping);
[availableLabels release];

[touchLabel1 release];
[touchLabel2 release];
[touchLabel3 release];
[touchLabel4 release];
[touchLabel5 release];

[super dealloc];
}


@end

___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Alex Kac
At least on the iPhone I can say that using NIBs can add a short delay or slow 
some UI operations down. Normally we prefer to use IB everywhere we can. On the 
iPhone we balance it more. Places where pure code is not difficult, we'll go 
that route because its noticeably faster. While its gotten better in iPhone OS 
3.0+, I can say that there have been a few places where using a NIB creates a 
non-smooth experience whereas using pure code is smooth as butter. And this is 
borne out in tech talks and WWDC recommendations.

iPhone dev has to keep in mind the fact its a CPU/memory limited device. 

On Dec 8, 2009, at 2:17 PM, Kyle Sluder wrote:

 On Tue, Dec 8, 2009 at 12:00 PM, Aldo Armiento lists.ap...@me.com wrote:
 The question is: why can I use my custom subclass of UINavigationBar in a 
 UINavigationController using IB and I can't do it programmatically? All that 
 can be done in IB should not be able to do programmatically?
 
 I guess one question is, why do you want to do this
 programmatically?  Prefer IB over writing code.
 
 Though you're right, you should be able to at least specify the class
 of navigation bar, if not provide your own instance.
 
 --Kyle Sluder
 ___
 
 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/alex%40webis.net
 
 This email sent to a...@webis.net

Alex Kac - President and Founder
Web Information Solutions, Inc.

There will always be death and taxes; however, death doesn't get worse every 
year.
-- Anonymous




___

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: CAShapeLayer and touches?

2009-12-08 Thread Eric E. Dolecki
Basically if a user touches the shape layer's path (the UI for the pointer),
I'd like the user to be able to slide it left and right. I did not subclass
UIView - I am using a rootLayer and using the path within that.
CAShapeLayers have hitTests? I haven't seen code like that anywhere yet
(Google). Any help appreciated.

On Tue, Dec 8, 2009 at 3:01 PM, David Duncan david.dun...@apple.com wrote:

 On Dec 8, 2009, at 11:34 AM, Eric E. Dolecki wrote:

  Looks like that method expects a UIView - what's the best way to access
 the
  CAShapeLayer to know whether or not a user's touched it? Then I'd like to
  constrain drag it.


 Are you trying to hit test against the shape layer's path? I'm not certain
 that is trivial. Does the shape layer have an associated view (i.e. did you
 subclass UIView to override +layerClass)? If so you could use that
 associated view. Otherwise you can use the layer's -hitTest: method to
 determine which layer was hit.
 --
 David Duncan
 Apple DTS Animation and Printing




-- 
http://ericd.net
Interactive design and development
___

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: CAShapeLayer and touches?

2009-12-08 Thread David Duncan
On Dec 8, 2009, at 12:47 PM, Eric E. Dolecki wrote:

 Basically if a user touches the shape layer's path (the UI for the pointer), 
 I'd like the user to be able to slide it left and right. I did not subclass 
 UIView - I am using a rootLayer and using the path within that. CAShapeLayers 
 have hitTests? I haven't seen code like that anywhere yet (Google). Any help 
 appreciated.


CAShapeLayer is a subclass of CALayer, and CALayer provides -hitTest:. However, 
I'm fairly certain that it is based on the layer's geometry (position, bounds, 
transform) rather than its content.
--
David Duncan
Apple DTS Animation and Printing

___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Aldo Armiento
Il giorno 08/dic/2009, alle ore 21.37, Alex Kac ha scritto:

 At least on the iPhone I can say that using NIBs can add a short delay or 
 slow some UI operations down. Normally we prefer to use IB everywhere we can. 
 On the iPhone we balance it more. Places where pure code is not difficult, 
 we'll go that route because its noticeably faster. While its gotten better in 
 iPhone OS 3.0+, I can say that there have been a few places where using a NIB 
 creates a non-smooth experience whereas using pure code is smooth as butter. 
 And this is borne out in tech talks and WWDC recommendations.
 

But it seems that in this case I can't use my UINavigationBar subclass if I 
instantiate a Navigation Controller programmatically, so the only way to use my 
UINavigationBar subclass is to instantiate a Navigation Controller in IB 
otherwise I can't change UINavigationBar class/instance, this makes sense? I'm 
forced to use IB?

Duccio

 iPhone dev has to keep in mind the fact its a CPU/memory limited device. 
 
 On Dec 8, 2009, at 2:17 PM, Kyle Sluder wrote:
 
 On Tue, Dec 8, 2009 at 12:00 PM, Aldo Armiento lists.ap...@me.com wrote:
 The question is: why can I use my custom subclass of UINavigationBar in a 
 UINavigationController using IB and I can't do it programmatically? All 
 that can be done in IB should not be able to do programmatically?
 
 I guess one question is, why do you want to do this
 programmatically?  Prefer IB over writing code.
 
 Though you're right, you should be able to at least specify the class
 of navigation bar, if not provide your own instance.
 
 --Kyle Sluder
 ___
 
 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/alex%40webis.net
 
 This email sent to a...@webis.net
 
 Alex Kac - President and Founder
 Web Information Solutions, Inc.
 
 There will always be death and taxes; however, death doesn't get worse every 
 year.
 -- Anonymous
 
 
 
 

___

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: CAShapeLayer and touches?

2009-12-08 Thread Eric E. Dolecki
Okay - so how would I use the bounds? I thought I tried that in my initial
code sample:

if( CGRectContainsPoint([*pointerLayer bounds*], [touch
locationInView:pointerLayer] )){

or is that part correct and the [touch locationInView:pointerLayer.view] be
correct?

Thanks,
Eric

On Tue, Dec 8, 2009 at 3:48 PM, David Duncan david.dun...@apple.com wrote:

 On Dec 8, 2009, at 12:47 PM, Eric E. Dolecki wrote:

  Basically if a user touches the shape layer's path (the UI for the
 pointer), I'd like the user to be able to slide it left and right. I did not
 subclass UIView - I am using a rootLayer and using the path within that.
 CAShapeLayers have hitTests? I haven't seen code like that anywhere yet
 (Google). Any help appreciated.


 CAShapeLayer is a subclass of CALayer, and CALayer provides -hitTest:.
 However, I'm fairly certain that it is based on the layer's geometry
 (position, bounds, transform) rather than its content.
 --
 David Duncan
 Apple DTS Animation and Printing




-- 
http://ericd.net
Interactive design and development
___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Luke the Hiesterman

On Dec 8, 2009, at 12:49 PM, Aldo Armiento wrote:

 But it seems that in this case I can't use my UINavigationBar subclass if I 
 instantiate a Navigation Controller programmatically, so the only way to use 
 my UINavigationBar subclass is to instantiate a Navigation Controller in IB 
 otherwise I can't change UINavigationBar class/instance, this makes sense? 
 I'm forced to use IB?

Given that the API labels this property as readonly and it's not really meant 
to contain anything other than a stock UINavigationBar, I'd recommend avoiding 
even using this approach in IB. If there is some customization you need that is 
not already available, I recommend filing an ER.

Luke___

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: CAShapeLayer and touches?

2009-12-08 Thread Eric E. Dolecki
I might just say forget it and wire up a UIImageView and have the user drag
that instead. I wanted to use vectors for this, but a PNG might be just as
good. It would be cool to know how to do this someday though.

On Tue, Dec 8, 2009 at 3:52 PM, Eric E. Dolecki edole...@gmail.com wrote:

 Okay - so how would I use the bounds? I thought I tried that in my initial
 code sample:

 if( CGRectContainsPoint([*pointerLayer bounds*], [touch
 locationInView:pointerLayer] )){

 or is that part correct and the [touch locationInView:pointerLayer.view]be 
 correct?

 Thanks,
 Eric

 On Tue, Dec 8, 2009 at 3:48 PM, David Duncan david.dun...@apple.comwrote:

 On Dec 8, 2009, at 12:47 PM, Eric E. Dolecki wrote:

  Basically if a user touches the shape layer's path (the UI for the
 pointer), I'd like the user to be able to slide it left and right. I did not
 subclass UIView - I am using a rootLayer and using the path within that.
 CAShapeLayers have hitTests? I haven't seen code like that anywhere yet
 (Google). Any help appreciated.


 CAShapeLayer is a subclass of CALayer, and CALayer provides -hitTest:.
 However, I'm fairly certain that it is based on the layer's geometry
 (position, bounds, transform) rather than its content.
 --
 David Duncan
 Apple DTS Animation and Printing




 --
 http://ericd.net
 Interactive design and development




-- 
http://ericd.net
Interactive design and development
___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Duccio

Il giorno 08/dic/2009, alle ore 21.53, Luke the Hiesterman ha scritto:

 
 On Dec 8, 2009, at 12:49 PM, Aldo Armiento wrote:
 
 But it seems that in this case I can't use my UINavigationBar subclass if I 
 instantiate a Navigation Controller programmatically, so the only way to use 
 my UINavigationBar subclass is to instantiate a Navigation Controller in IB 
 otherwise I can't change UINavigationBar class/instance, this makes sense? 
 I'm forced to use IB?
 
 Given that the API labels this property as readonly and it's not really meant 
 to contain anything other than a stock UINavigationBar, I'd recommend 
 avoiding even using this approach in IB. If there is some customization you 
 need that is not already available, I recommend filing an ER.
 

I'm new to Apple development, what does it mean filing an ER? It's like a 
feature request?

Thanks,
Duccio.

 Luke

___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Luke the Hiesterman

On Dec 8, 2009, at 1:13 PM, Duccio wrote:

 
 Il giorno 08/dic/2009, alle ore 21.53, Luke the Hiesterman ha scritto:
 
 
 On Dec 8, 2009, at 12:49 PM, Aldo Armiento wrote:
 
 But it seems that in this case I can't use my UINavigationBar subclass if I 
 instantiate a Navigation Controller programmatically, so the only way to 
 use my UINavigationBar subclass is to instantiate a Navigation Controller 
 in IB otherwise I can't change UINavigationBar class/instance, this makes 
 sense? I'm forced to use IB?
 
 Given that the API labels this property as readonly and it's not really 
 meant to contain anything other than a stock UINavigationBar, I'd recommend 
 avoiding even using this approach in IB. If there is some customization you 
 need that is not already available, I recommend filing an ER.
 
 
 I'm new to Apple development, what does it mean filing an ER? It's like a 
 feature request?

Precisely. Check out http://developer.apple.com/bugreporter/

Luke___

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: CAShapeLayer and touches?

2009-12-08 Thread David Duncan
On Dec 8, 2009, at 12:52 PM, Eric E. Dolecki wrote:

 Okay - so how would I use the bounds? I thought I tried that in my initial 
 code sample:


Your making this too complicated :).

if([self.view.layer hitTest:[touch locationInView:self]] == pointLayer]) {
// my shape layer got hit
}
--
David Duncan
Apple DTS Animation and Printing

___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread David Duncan
On Dec 8, 2009, at 12:49 PM, Aldo Armiento wrote:

 But it seems that in this case I can't use my UINavigationBar subclass if I 
 instantiate a Navigation Controller programmatically, so the only way to use 
 my UINavigationBar subclass is to instantiate a Navigation Controller in IB 
 otherwise I can't change UINavigationBar class/instance, this makes sense? 
 I'm forced to use IB?


Since we've come around to file an ER then an appropriate question seems to 
be what are you trying to accomplish by subclassing the UINavigationBar?
--
David Duncan
Apple DTS Animation and Printing

___

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: Big memory/time consumption in NSTreeController KVO GC

2009-12-08 Thread Benjamin Rister
On Dec 8, 2009, at 2:44 PM, jonat...@mugginsoft.com wrote:

 Any ideas about why NSTreeController’s KVO is taking up so much memory/CPU 
 with bookkeeping? Any suggestions for working around the problem?
 
 I assume that you are using bindings.

Yes.

 Looks like  a typical KVO notification storm to me.
 What works well for adding and updating one or two objects can easily turn to 
 sludge for larger object numbers as thousands of KVO notifications are sent.
 This isn't bookkeeping - its KVO doing what you asked it to do - telling you 
 about every change to your model.

Well...not quite. There’s nothing about doing this notification that requires 
allocating hundreds of megabytes of overhead, particularly when the model 
itself is a fraction of that size, including payload. As I mentioned, these 
blocks it’s allocating are 16KB each. I can’t fathom what legitimate data you 
could possibly keep to do this observation that would take up that much space. 
In addition, if you look at the stack trace, most of the memory allocations are 
happening in response to NSKeyValueObservanceBecameUseless; thus, it’s 
happening after all of the actual, real work is done.

It’s entirely speculation, but this could be explained by transient KVO stuff 
not being garbage collected properly, like it’s being kept alive unnecessarily.

Also, while I forgot to mention this in the original email, the allocations 
follow a sawtooth pattern with a period of around 1-2 minutes, rising steadily 
then suddenly vanishing in an instant. This could support the GC hypothesis, or 
just be a red herring. Maybe these allocations are being missed by the 
generational collector for some reason, and are only caught by exhaustive 
collections? Or maybe some structure/cache/buffer is being periodically 
flushed, dropping the references? The model objects are gone (obviously, since 
that’s what triggers the allocations), so it shouldn’t be me keeping them alive.

 Are you adding your nodes to the NSTreeControllers content while bindings are 
 active?
 If you build your tree separately and then set the NSTreeController 
 content/binding then things should improve drastically.

Unfortunately, this isn’t static content. It’s dynamic, and needs to change in 
response to external conditions. So the KVO notifications themselves are 
necessary in this approach, the overhead just seems unreasonable.

Best,
Benjamin___

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: NSRulerMarker and dragging

2009-12-08 Thread James Dempsey
Arved,

There is currently no API to do this.

Please submit an enhancement request through bugreporter.apple.com.

-James

On Oct 17, 2009, at 9:45 PM, Arved von Brasch wrote:

 Hello Cocoa List,
 
 My Googling reveals this question has been asked before, but no answer was 
 given.  Hopefully someone knows how to do this now.
 
 I have a vertical NSRulerView attached to an NSTextView.  I have movable 
 NSRulerMarkers and that's all working good.  My only problem is that the 
 NSRulerMarkers insist on displaying a tooltip with the current measurement 
 values when the marker is being dragged.  This is not appropriate in my 
 application.  Ideally, I would like to suppress these tooltips.
 
 I have tried intercepting various things in my NSRulerView subclass.  These 
 typically didn't work because the ruler view doesn't seem to be responsible 
 for the generation of the tooltips.  NSRulerMarker doesn't seem to have 
 functionality to do this, and doesn't inherit from NSView either.
 
 Another way to manage this might be to provide a dynamic measurement unit.  
 My markers are essentially pointers into the text, and really are indicating 
 specific line numbers, like break points.  Dynamic measurements would be 
 necessary because the font of the TextView can be set by the user, and where 
 the marker is pointing will then depend on the font size.  There doesn't seem 
 to be a way to do this either.
 
 Is there something I'm missing?  Surely this is something someone has 
 attempted before?
 
 Thanks in advance,
 
 Arved
 ___
 
 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/dempsey%40apple.com
 
 This email sent to demp...@apple.com

--
James Dempsey
AppKit Engineering
Apple
demp...@apple.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: CAShapeLayer and touches?

2009-12-08 Thread Eric E. Dolecki
I send to you many thanks.

On Tue, Dec 8, 2009 at 4:17 PM, David Duncan david.dun...@apple.com wrote:

 On Dec 8, 2009, at 12:52 PM, Eric E. Dolecki wrote:

  Okay - so how would I use the bounds? I thought I tried that in my
 initial code sample:


 Your making this too complicated :).

 if([self.view.layer hitTest:[touch locationInView:self]] == pointLayer]) {
// my shape layer got hit
 }
 --
 David Duncan
 Apple DTS Animation and Printing




-- 
http://ericd.net
Interactive design and development
___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Duccio

Il giorno 08/dic/2009, alle ore 22.19, David Duncan ha scritto:

 On Dec 8, 2009, at 12:49 PM, Aldo Armiento wrote:
 
 But it seems that in this case I can't use my UINavigationBar subclass if I 
 instantiate a Navigation Controller programmatically, so the only way to use 
 my UINavigationBar subclass is to instantiate a Navigation Controller in IB 
 otherwise I can't change UINavigationBar class/instance, this makes sense? 
 I'm forced to use IB?
 
 
 Since we've come around to file an ER then an appropriate question seems to 
 be what are you trying to accomplish by subclassing the UINavigationBar?

I'm drawing a navigation bar background image overriding drawRect: method. If 
in Interface Builder I change Navigation Bar class from UINavigationBar to 
CustomNavigationBar it works properly. How do that programmatically?

@interface CustomNavigationBar : UINavigationBar {
}
@end

@implementation CustomNavigationBar
- (void)drawRect:(CGRect)rect {
[[UIImage imageNamed:@image.png] drawInRect:rect];
}
@end

 --
 David Duncan
 Apple DTS Animation and Printing
 

___

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: Big memory/time consumption in NSTreeController KVO GC

2009-12-08 Thread Greg Parker
On Dec 8, 2009, at 1:22 PM, Benjamin Rister wrote:
 Well...not quite. There’s nothing about doing this notification that requires 
 allocating hundreds of megabytes of overhead, particularly when the model 
 itself is a fraction of that size, including payload. As I mentioned, these 
 blocks it’s allocating are 16KB each. I can’t fathom what legitimate data you 
 could possibly keep to do this observation that would take up that much 
 space. In addition, if you look at the stack trace, most of the memory 
 allocations are happening in response to NSKeyValueObservanceBecameUseless; 
 thus, it’s happening after all of the actual, real work is done.

Which OS version is this? 10.6.2 fixed a performance problem with garbage 
collection and large KVO populations. If you still have trouble in 10.6.2+ then 
you should file a bug report.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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: Binding and Observers

2009-12-08 Thread Steve Steinitz

Hi Gerriet,

On 8/12/09, gerr...@mdenkmann.de wrote:


MyDocument.nib has an IKImageView  and an NSSlider with it's value
bound to myIkView.rotationAngle.  But when I closed the window I got
an exception complaining about some observers not beeing removed.


Is it the 'Cannot remove observer...' exception?  If so, its 
nasty and difficult to work around.  Worse, once the exception 
occurs the app is left in an unstable state, which may be why 
you eventually get the EXC_BAD_ACCESS.  I currently just put up 
a message with a Relaunch button after catching the exception.  
Its embarrassing but after over two years of struggling, 
stammering and making excuses for 'Cannot remove observer...', 
that's all I've got.


One glimmer of hope I'm pursuing as of yesterday is adding 
custom methods to change bindings like myIkView.rotationAngle to 
myIkViewRotationAngle along with the appropriate 
keyPathsForValuesAffecting... methods.  For what its worth.


Previously, I added code to Core Data relationship setters to 
remove objects from any existing relationship before setting a 
new one.  I'm not sure if that accomplished anything but one 
gets to the point where one will try anything.


I've heard rumblings that the problem got worse with 10.6 rather 
than better.  I'm starting some testing on that now before I 
migrate clients.


If you have a simple test case, filing a bug report won't hurt.  
But if history is any indication it may not help much either.  bugreport.apple.com


Good luck,

Steve

___

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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford

On Dec 8, 2009, at 12:33 pm, mmalc Crawford wrote:
Get the logic right...

 - (void)setUpTouchHandling {
 
touchToLabelMapping = CFDictionaryCreateMutable (kCFAllocatorDefault, 5, 
 kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks);
availableLabels = [[NSMutableArray alloc] initWithObjects:touchLabel1, 
 touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
 }
 
- (void)setUpTouchHandling {

touchToLabelMapping = CFDictionaryCreateMutable (kCFAllocatorDefault, 5, 
kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks);
availableLabels = [[NSMutableArray alloc] initWithObjects:touchLabel1, 
touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
setUp = YES;
}


... and improve the user experience accordingly:

 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
 
for (UITouch *touch in touches) {
if (touch.view == self) {
UILabel *label = (UILabel 
 *)CFDictionaryGetValue(touchToLabelMapping, touch);
label.text = @{0, 0};
CFDictionaryRemoveValue (touchToLabelMapping, touch);
[availableLabels addObject:label];
}
}
 }
 
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

for (UITouch *touch in touches) {
if (touch.view == self) {

UILabel *label = (UILabel 
*)CFDictionaryGetValue(touchToLabelMapping, touch);
label.text = @{0, 0};
CFDictionaryRemoveValue (touchToLabelMapping, touch);
[availableLabels insertObject:label atIndex:0];
}
}
}


(I'm using setUpTouchHandling so that this will work however you configure your 
view or view controller -- ideally you choose a more appropriate initialisation 
locus.)

mmalc


___

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: Binding and Observers

2009-12-08 Thread mmalc Crawford

On Dec 8, 2009, at 2:17 am, Gerriet M. Denkmann wrote:

 - (void)windowWillClose:(NSNotification *)notification
 {
   id f = [ ikView observationInfo ];
   NSString *oi = [ f description ];
   
   BOOL ok;
   NSString *obs = @Observer:;
   NSString *kpa = @Key path:;
   unsigned long long uuu;
   NSString *keyPath1;
   
   NSScanner *u = [ NSScanner scannerWithString: oi ];
   [ u setCharactersToBeSkipped: [ NSCharacterSet 
 whitespaceAndNewlineCharacterSet ] ];
   
   ok = [ u scanUpToString: obs intoString: NULL ];
   ok = [ u scanString: obs intoString: NULL ];
   ok = [ u scanHexLongLong: uuu ];
   ok = [ u scanUpToString: kpa intoString: NULL ];
   ok = [ u scanString: kpa intoString: NULL ];
   ok = [ u scanUpToString: @, intoString: keyPath1 ];
   [ myIkView removeObserver: (id)uuu  forKeyPath: keyPath1 ];
 }
 


???!!
What's wrong with unbind:?
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSKeyValueBindingCreation_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/unbind:

mmalc


___

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: Big memory/time consumption in NSTreeController KVO GC

2009-12-08 Thread Rob Keniger

On 09/12/2009, at 7:35 AM, Greg Parker wrote:

 Which OS version is this? 10.6.2 fixed a performance problem with garbage 
 collection and large KVO populations. If you still have trouble in 10.6.2+ 
 then you should file a bug report.


There are still massive remaining performance issues with 
NSTreeController/NSArrayController in 10.6 if you have a large number of active 
bindings. 

Please see my bug report rdar://7139579 which includes a simple sample project. 
The performance on Snow Leopard is orders of magnitude slower than in 10.5.

All of the problems seem to relate to the private class NSConcretePointerArray 
and something that it's doing with weak references. That seems to be involved 
in Benjamin's case and it is definitely the problem in our case based on Shark 
traces. 

Specifically, the routines auto_read_weak_reference(), readWeakAt() and 
objc_read_weak() that appear to be involved in the the -compact method of 
NSConcretePointerArray are taking up an inordinate amount of CPU time.

--
Rob Keniger



___

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


Improving speed of NSCollectionView scrolling

2009-12-08 Thread PCWiz
Hi,

I am using NSCollectionView for a project in which the collection view is 
populated with about 200 items, each containing about 4 subviews (image view, 
and a few text fields).

Scrolling is not smooth at all, and lags quite a bit. I'm wondering, would just 
drawing the text and images as part of the view in the prototype views drawRect 
method yield any increase in smoothness, rather than using subviews?

Thanks___

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: Improving speed of NSCollectionView scrolling

2009-12-08 Thread Mike Abdullah

On 8 Dec 2009, at 23:40, PCWiz wrote:

 Hi,
 
 I am using NSCollectionView for a project in which the collection view is 
 populated with about 200 items, each containing about 4 subviews (image view, 
 and a few text fields).
 
 Scrolling is not smooth at all, and lags quite a bit. I'm wondering, would 
 just drawing the text and images as part of the view in the prototype views 
 drawRect method yield any increase in smoothness, rather than using subviews?

Why are you asking us this now? It sounds like you haven't done any performance 
profiling to find out what's actually slow. Do that and then come back.

If it suits your needs, IKImageBrowserView is somewhat faster than 
NSCollectionView.___

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: Fwd: nscalendardate with 10.4

2009-12-08 Thread Sean McBride
On 12/7/09 2:32 PM, Sissy said:



 i've complete my project which runs great on 10.5 leopard and i am
 trying to compile it to work with 10.4 (tiger).  i use
 nscalendardate which uses nsinteger which does not exist in 10.4.
 how do i adjust dates using nscalendardate which is supposed to work
 with 10.0 and later without having the use of nsinteger which only
 works on 10.5 and later.
 - (NSCalendarDate *)dateByAddingYears:(NSInteger)year months:
 (NSInteger)month days:(NSInteger)day hours:(NSInteger)hourminutes:
 (NSInteger)minute seconds:(NSInteger)second
 my code:
 //   NSInteger counter = [selectDate dayOfWeek];
  int counter = [selectDate dayOfWeek];

 //   NSLog(@dates are picker %@ and calendar %@  and counter is
 %i,theDate,selectDate,counter); 
  NSCalendarDate *tempDate = [selectDate dateByAddingYears:0 months:0
 days: -counter  hours:0 minutes:0 seconds:0];

Sissy,

NSInteger is just a typedef and it's only used in the 10.5 and later
SDKs.  But you can use the 10.5 SDK and still support 10.4.  You just
need to change your deployment target to 10.4.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Mike Abdullah

On 8 Dec 2009, at 20:49, Aldo Armiento wrote:

 Il giorno 08/dic/2009, alle ore 21.37, Alex Kac ha scritto:
 
 At least on the iPhone I can say that using NIBs can add a short delay or 
 slow some UI operations down. Normally we prefer to use IB everywhere we 
 can. On the iPhone we balance it more. Places where pure code is not 
 difficult, we'll go that route because its noticeably faster. While its 
 gotten better in iPhone OS 3.0+, I can say that there have been a few places 
 where using a NIB creates a non-smooth experience whereas using pure code is 
 smooth as butter. And this is borne out in tech talks and WWDC 
 recommendations.
 
 
 But it seems that in this case I can't use my UINavigationBar subclass if I 
 instantiate a Navigation Controller programmatically, so the only way to use 
 my UINavigationBar subclass is to instantiate a Navigation Controller in IB 
 otherwise I can't change UINavigationBar class/instance, this makes sense? 
 I'm forced to use IB?

If something can be done in IB, it can almost certainly be done 
programmatically. Whether it will be easy is another matter.

Nibs are loaded by unarchiving the objects within using the NSKeyedUnarchiving 
protocol. Therefore, one can get the same effect in code by unarchiving a 
UINavigationController while customising the archiver to substitute your custom 
class for UINavigationBar. Tedious, but doable.

Other alternatives:

- Subclass UINavigationController to return a custom view from -navigationBar.
- Add a custom subview to the nav bar to do your 
drawing.___

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: odd problems with NSData / OpenGL

2009-12-08 Thread Henri Häkkinen

On Dec 8, 2009, at 6:42 PM, David Duncan wrote:

 More than likely this is a memory management problem. Specifically, you 
 probably aren't claiming ownership of the NSData object that you store in 
 your instance variable, and thus it is being deallocated out from under you.

I was under the impression that automatic garbage collection was used in Mac OS 
X 10.5 and over, so retaining and releasing objects was handled automatically?

This is the initializer method of my Mesh class (I'm using OpenCTM library for 
importing triangle meshes):

- (id)initWithContentsOfFile:(NSString *)path
{
self = [super init];
if (self) {
// Create an OpenCTM context and load the mesh from disk.
CTMcontext context = ctmNewContext(CTM_IMPORT);
ctmLoad(context, [path UTF8String]);

// Check OpenCTM errors.
CTMenum error = ctmGetError(context);   
if (error != CTM_NONE) {
NSLog(@OpenCTM error while opening %@: %s (%d), path, 
ctmErrorString(error), error);
ctmFreeContext(context);
[self dealloc];
return nil;
}

// Store the geometry arrays.
_vertices = [NSData dataWithBytes:ctmGetFloatArray(context, 
CTM_VERTICES)
   
length:ctmGetInteger(context, CTM_VERTEX_COUNT) * sizeof(CTMfloat[3])];

_indices = [NSData dataWithBytes:ctmGetIntegerArray(context, 
CTM_INDICES)
  
length:ctmGetInteger(context, CTM_TRIANGLE_COUNT) * sizeof(CTMuint[3])];

// Calculate the bounding sphere radius.
for (CTMuint i = 0; i  ctmGetInteger(context, 
CTM_VERTEX_COUNT) * 3; i += 3) {
const CTMfloat x = ctmGetFloatArray(context, 
CTM_VERTICES)[i + 0];
const CTMfloat y = ctmGetFloatArray(context, 
CTM_VERTICES)[i + 1];
const CTMfloat z = ctmGetFloatArray(context, 
CTM_VERTICES)[i + 2];

_radius = MAX(sqrt(x*x + y*y + z*z), _radius);
}

// Release the OpenCTM context.
ctmFreeContext(context);
}
return self;
}


 --
 David Duncan
 Apple DTS Animation and Printing
 


Regards,
Henri Häkkinen

___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Luke the Hiesterman

On Dec 8, 2009, at 3:51 PM, Mike Abdullah wrote:

 Other alternatives:
 
 - Subclass UINavigationController to return a custom view from -navigationBar.
 - Add a custom subview to the nav bar to do your drawing.

I recommend neither of these. It's already been brought up that 
UINavigationController shouldn't be subclassed, and it isn't meant as a 
container for arbitrary views, either. If you really aren't satisfied with 
using a tint color for the background, file an ER asking for an API to provide 
a background image.

Luke___

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: Improving speed of NSCollectionView scrolling

2009-12-08 Thread PCWiz
Sorry I'm new to Obj-C/Cocoa, how would I do this performance profiling?

On 2009-12-08, at 4:50 PM, Mike Abdullah wrote:

 
 On 8 Dec 2009, at 23:40, PCWiz wrote:
 
 Hi,
 
 I am using NSCollectionView for a project in which the collection view is 
 populated with about 200 items, each containing about 4 subviews (image 
 view, and a few text fields).
 
 Scrolling is not smooth at all, and lags quite a bit. I'm wondering, would 
 just drawing the text and images as part of the view in the prototype views 
 drawRect method yield any increase in smoothness, rather than using subviews?
 
 Why are you asking us this now? It sounds like you haven't done any 
 performance profiling to find out what's actually slow. Do that and then come 
 back.
 
 If it suits your needs, IKImageBrowserView is somewhat faster than 
 NSCollectionView.

___

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: odd problems with NSData / OpenGL

2009-12-08 Thread David Duncan
If you don't turn GC on, then you likely don't have it on. Check your  
project settings, as most if the project templates do not enable GC.


--
David Duncan @ My iPhone

On Dec 8, 2009, at 3:52 PM, Henri Häkkinen hen...@henuxsoft.com  
wrote:




On Dec 8, 2009, at 6:42 PM, David Duncan wrote:

More than likely this is a memory management problem. Specifically,  
you probably aren't claiming ownership of the NSData object that  
you store in your instance variable, and thus it is being  
deallocated out from under you.


I was under the impression that automatic garbage collection was  
used in Mac OS X 10.5 and over, so retaining and releasing objects  
was handled automatically?


This is the initializer method of my Mesh class (I'm using OpenCTM  
library for importing triangle meshes):


- (id)initWithContentsOfFile:(NSString *)path
{
   self = [super init];
   if (self) {
   // Create an OpenCTM context and load the mesh from disk.
   CTMcontext context = ctmNewContext(CTM_IMPORT);
   ctmLoad(context, [path UTF8String]);

   // Check OpenCTM errors.
   CTMenum error = ctmGetError(context);
   if (error != CTM_NONE) {
   NSLog(@OpenCTM error while opening %@: %s (%d), path,  
ctmErrorString(error), error);

   ctmFreeContext(context);
   [self dealloc];
   return nil;
   }

   // Store the geometry arrays.
   _vertices = [NSData dataWithBytes:ctmGetFloatArray(context,  
CTM_VERTICES)
  length:ctmGetInteger(context,  
CTM_VERTEX_COUNT) * sizeof(CTMfloat[3])];


   _indices = [NSData dataWithBytes:ctmGetIntegerArray(context,  
CTM_INDICES)
 length:ctmGetInteger(context,  
CTM_TRIANGLE_COUNT) * sizeof(CTMuint[3])];


   // Calculate the bounding sphere radius.
   for (CTMuint i = 0; i  ctmGetInteger(context,  
CTM_VERTEX_COUNT) * 3; i += 3) {
   const CTMfloat x = ctmGetFloatArray(context, CTM_VERTICES) 
[i + 0];
   const CTMfloat y = ctmGetFloatArray(context, CTM_VERTICES) 
[i + 1];
   const CTMfloat z = ctmGetFloatArray(context, CTM_VERTICES) 
[i + 2];


   _radius = MAX(sqrt(x*x + y*y + z*z), _radius);
   }

   // Release the OpenCTM context.
   ctmFreeContext(context);
   }
   return self;
}



--
David Duncan
Apple DTS Animation and Printing




Regards,
Henri Häkkinen


___

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: odd problems with NSData / OpenGL

2009-12-08 Thread Nick Zitzmann

On Dec 8, 2009, at 4:52 PM, Henri Häkkinen wrote:

 I was under the impression that automatic garbage collection was used in Mac 
 OS X 10.5 and over, so retaining and releasing objects was handled 
 automatically?

No; you have to turn it on in the application, for two reasons:

1. Tiger and earlier do not support loading apps/libraries/bundles with GC 
support, optional or not.
2. If you want to make an app with GC support, then all of its libraries  
bundles must also have at least optional support for GC, or they won't load.

Nick Zitzmann
http://www.chronosnet.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


Finding process path from Cocoa?

2009-12-08 Thread Laurent Daudelin
Is there any way I can find what's the path of a given process running? A 
background process, which cannot be retrieved in [[NSWorkspace sharedWorkspace] 
launchedApplications]?

Thanks!




-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread Chunk 1978
i'm very grateful for your help.  thanks so much for posting such a
complete solution.  i'm certain there will be others like myself who
will find your code extremely helpful.  thanks again.

On Tue, Dec 8, 2009 at 5:24 PM, mmalc Crawford mmalc_li...@me.com wrote:

 On Dec 8, 2009, at 12:33 pm, mmalc Crawford wrote:
 Get the logic right...

 - (void)setUpTouchHandling {

    touchToLabelMapping = CFDictionaryCreateMutable (kCFAllocatorDefault, 5, 
 kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks);
    availableLabels = [[NSMutableArray alloc] initWithObjects:touchLabel1, 
 touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
 }

 - (void)setUpTouchHandling {

    touchToLabelMapping = CFDictionaryCreateMutable (kCFAllocatorDefault, 5, 
 kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks);
    availableLabels = [[NSMutableArray alloc] initWithObjects:touchLabel1, 
 touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
    setUp = YES;
 }


 ... and improve the user experience accordingly:

 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    for (UITouch *touch in touches) {
        if (touch.view == self) {
            UILabel *label = (UILabel 
 *)CFDictionaryGetValue(touchToLabelMapping, touch);
            label.text = @{0, 0};
            CFDictionaryRemoveValue (touchToLabelMapping, touch);
            [availableLabels addObject:label];
        }
    }
 }

 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    for (UITouch *touch in touches) {
        if (touch.view == self) {

            UILabel *label = (UILabel 
 *)CFDictionaryGetValue(touchToLabelMapping, touch);
            label.text = @{0, 0};
            CFDictionaryRemoveValue (touchToLabelMapping, touch);
            [availableLabels insertObject:label atIndex:0];
        }
    }
 }


 (I'm using setUpTouchHandling so that this will work however you configure 
 your view or view controller -- ideally you choose a more appropriate 
 initialisation locus.)

 mmalc


 ___

 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/chunk1978%40gmail.com

 This email sent to chunk1...@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: odd problems with NSData / OpenGL

2009-12-08 Thread Sean McBride
On 12/9/09 1:52 AM, Henri Häkkinen said:

I was under the impression that automatic garbage collection was used in
Mac OS X 10.5 and over, so retaining and releasing objects was handled
automatically?

Mostly automatic. :)

This is the initializer method of my Mesh class (I'm using OpenCTM
library for importing triangle meshes):

- (id)initWithContentsOfFile:(NSString *)path
{
   self = [super init];
   if (self) {
   // Create an OpenCTM context and load the mesh from disk.
   CTMcontext context = ctmNewContext(CTM_IMPORT);
   ctmLoad(context, [path UTF8String]);
   
   // Check OpenCTM errors.
   CTMenum error = ctmGetError(context);   
   if (error != CTM_NONE) {
   NSLog(@OpenCTM error while opening %@: %s (%d), path, 
 ctmErrorString
(error), error);
   ctmFreeContext(context);
   [self dealloc];
   return nil;
   }
   
   // Store the geometry arrays.
   _vertices = [NSData dataWithBytes:ctmGetFloatArray(context, 
 CTM_VERTICES)
  
 length:ctmGetInteger(context, CTM_VERTEX_COUNT) * sizeof
(CTMfloat[3])];
   
   _indices = [NSData dataWithBytes:ctmGetIntegerArray(context, 
 CTM_INDICES)
 
 length:ctmGetInteger(context, CTM_TRIANGLE_COUNT) * sizeof
(CTMuint[3])];

And these are ivars I guess?  If so, they should live as long as 'self' does.

Do you use the 'bytes' method?  Are you aware of the issues with it under GC?

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: Finding process path from Cocoa?

2009-12-08 Thread Nick Zitzmann

On Dec 8, 2009, at 5:03 PM, Laurent Daudelin wrote:

 Is there any way I can find what's the path of a given process running? A 
 background process, which cannot be retrieved in [[NSWorkspace 
 sharedWorkspace] launchedApplications]?

Yes. ([[[NSProcessInfo processInfo] arguments] objectAtIndex:0])

Nick Zitzmann
http://www.chronosnet.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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Mike Abdullah

On 8 Dec 2009, at 23:57, Luke the Hiesterman wrote:

 
 On Dec 8, 2009, at 3:51 PM, Mike Abdullah wrote:
 
 Other alternatives:
 
 - Subclass UINavigationController to return a custom view from 
 -navigationBar.
 - Add a custom subview to the nav bar to do your drawing.
 
 I recommend neither of these. It's already been brought up that 
 UINavigationController shouldn't be subclassed, and it isn't meant as a 
 container for arbitrary views, either. If you really aren't satisfied with 
 using a tint color for the background, file an ER asking for an API to 
 provide a background image.

Final other option then, +[UIColor colorWithPatternImage:] and set that as the 
tint.

___

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: odd problems with NSData / OpenGL

2009-12-08 Thread Henri Häkkinen

On Dec 9, 2009, at 2:05 AM, Sean McBride wrote:
 
 And these are ivars I guess?  If so, they should live as long as 'self' does.

Yes, they are ivars.

I was able to resolve the issue by adding invocation to retain: for both 
_vertices and _indices. So yep, it was a memory management issue. I better read 
the Memory Management and Garbage Collection guides again.


 Do you use the 'bytes' method?  Are you aware of the issues with it under GC?

Yes, I do use their bytes method when accessing their contents in drawRect: 
method. What are the issues?


Regards,
Henri Häkkinen

___

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: Improving speed of NSCollectionView scrolling

2009-12-08 Thread Mike Abdullah
Read up on Instruments.
http://developer.apple.com/tools/performance/

On 8 Dec 2009, at 23:57, PCWiz wrote:

 Sorry I'm new to Obj-C/Cocoa, how would I do this performance profiling?
 
 On 2009-12-08, at 4:50 PM, Mike Abdullah wrote:
 
 
 On 8 Dec 2009, at 23:40, PCWiz wrote:
 
 Hi,
 
 I am using NSCollectionView for a project in which the collection view is 
 populated with about 200 items, each containing about 4 subviews (image 
 view, and a few text fields).
 
 Scrolling is not smooth at all, and lags quite a bit. I'm wondering, would 
 just drawing the text and images as part of the view in the prototype views 
 drawRect method yield any increase in smoothness, rather than using 
 subviews?
 
 Why are you asking us this now? It sounds like you haven't done any 
 performance profiling to find out what's actually slow. Do that and then 
 come back.
 
 If it suits your needs, IKImageBrowserView is somewhat faster than 
 NSCollectionView.
 
 ___
 
 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: Improving speed of NSCollectionView scrolling

2009-12-08 Thread Corbin Dunn

On Dec 8, 2009, at 3:40 PM, PCWiz wrote:

 Hi,
 
 I am using NSCollectionView for a project in which the collection view is 
 populated with about 200 items, each containing about 4 subviews (image view, 
 and a few text fields).

You may want to consider using a different view. NSCollectionView does not do 
any special things for views that aren't visible, and you get one view for each 
item. So, in this case, you have at least 5 * 200 = 1000 views. That's a lot. 
Try IKImageBrowserView or NSTableView/NSOutlineView.

corbin


___

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: odd problems with NSData / OpenGL

2009-12-08 Thread Sean McBride
On 12/9/09 2:25 AM, Henri Häkkinen said:

On Dec 9, 2009, at 2:05 AM, Sean McBride wrote:

 And these are ivars I guess?  If so, they should live as long as
'self' does.

Yes, they are ivars.

I was able to resolve the issue by adding invocation to retain: for both
_vertices and _indices. So yep, it was a memory management issue. I
better read the Memory Management and Garbage Collection guides again.

retain does nothing with garbage collection, therefore you aren't using
garbage collection.

 Do you use the 'bytes' method?  Are you aware of the issues with it
under GC?

Yes, I do use their bytes method when accessing their contents in
drawRect: method. What are the issues?

http://lists.apple.com/archives/Cocoa-dev/2008/Jun/msg00603.html

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Duccio
Il giorno 09/dic/2009, alle ore 00.57, Luke the Hiesterman ha scritto:

 
 On Dec 8, 2009, at 3:51 PM, Mike Abdullah wrote:
 
 Other alternatives:
 
 - Subclass UINavigationController to return a custom view from 
 -navigationBar.
 - Add a custom subview to the nav bar to do your drawing.
 
 I recommend neither of these. It's already been brought up that 
 UINavigationController shouldn't be subclassed, and it isn't meant as a 
 container for arbitrary views, either. If you really aren't satisfied with 
 using a tint color for the background, file an ER asking for an API to 
 provide a background image.
 

So, just to understand, why can I do that through IB but not (legally) via 
code? The ability to choose a class for the navigation bar in a navigation 
controller should have been blocked in IB? 

You says about change Navigation Bar class to my subclass in IB recommend 
avoiding even using this approach in IB, why? Should I read this in 
documentation or I would have inferred by readonly navigationBar property 
(because next time I would not ask the list similar question/problem)?

I started working with Cocoa Touch a few days ago and I will not only learn the 
techniques but also best practices, philosophy and so on...

 Luke


Thanks,
Duccio
___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Luke the Hiesterman

On Dec 8, 2009, at 4:40 PM, Duccio wrote:

 Il giorno 09/dic/2009, alle ore 00.57, Luke the Hiesterman ha scritto:
 
 
 On Dec 8, 2009, at 3:51 PM, Mike Abdullah wrote:
 
 Other alternatives:
 
 - Subclass UINavigationController to return a custom view from 
 -navigationBar.
 - Add a custom subview to the nav bar to do your drawing.
 
 I recommend neither of these. It's already been brought up that 
 UINavigationController shouldn't be subclassed, and it isn't meant as a 
 container for arbitrary views, either. If you really aren't satisfied with 
 using a tint color for the background, file an ER asking for an API to 
 provide a background image.
 
 
 So, just to understand, why can I do that through IB but not (legally) via 
 code? The ability to choose a class for the navigation bar in a navigation 
 controller should have been blocked in IB? 
 
 You says about change Navigation Bar class to my subclass in IB recommend 
 avoiding even using this approach in IB, why? Should I read this in 
 documentation or I would have inferred by readonly navigationBar property 
 (because next time I would not ask the list similar question/problem)?
 
 I started working with Cocoa Touch a few days ago and I will not only learn 
 the techniques but also best practices, philosophy and so on...

Yes, the readonly is the key. Using IB to set the class of the navBar can be 
thought of as a sort of work-around to the issue that a readonly property isn't 
meant to be directly changed. Note, though, that you can safely modify 
writeable properties of a readonly property. Example:

UINavigationController has a navigationBar property, which is readonly, so you 
can't change it, but...
UINavigationBar has a tintColor property which IS writeable, so while you can't 
provide a different navigationBar, you can modify some properties of the bar 
itself.

Hope that helps, and I wish you the best writing great iPhone code!

Luke___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Duccio
Il giorno 09/dic/2009, alle ore 01.49, Luke the Hiesterman ha scritto:

 
 So, just to understand, why can I do that through IB but not (legally) via 
 code? The ability to choose a class for the navigation bar in a navigation 
 controller should have been blocked in IB? 
 
 You says about change Navigation Bar class to my subclass in IB recommend 
 avoiding even using this approach in IB, why? Should I read this in 
 documentation or I would have inferred by readonly navigationBar property 
 (because next time I would not ask the list similar question/problem)?
 
 I started working with Cocoa Touch a few days ago and I will not only learn 
 the techniques but also best practices, philosophy and so on...
 
 Yes, the readonly is the key. Using IB to set the class of the navBar can be 
 thought of as a sort of work-around to the issue that a readonly property 
 isn't meant to be directly changed. Note, though, that you can safely modify 
 writeable properties of a readonly property. Example:
 
 UINavigationController has a navigationBar property, which is readonly, so 
 you can't change it, but...
 UINavigationBar has a tintColor property which IS writeable, so while you 
 can't provide a different navigationBar, you can modify some properties of 
 the bar itself.
 

Yes, I know, but no backgroundImage property :-) And Apple documentations says, 
for example: It is permissible to modify the barStyle or translucent 
properties of the navigation bar but you must never change its frame,bounds, or 
alpha values directly. so very restrictive...

 Hope that helps, and I wish you the best writing great iPhone code!
 

Many thanks for the tips and the good wishes

 Luke


Duccio
___

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


resize handle and custom view classes

2009-12-08 Thread Henri Häkkinen
Hello.

In cases where a custom view class occupies the whole NSWindow content area, 
the resize handle at the bottom right corner gets overdrawn and stays behind 
the graphics. Is there any easy way of telling Cocoa that the resize handle 
should be drawn on top of any other graphics?

For example, put a NSOpenGLView to a window and make it as large as the 
window's content area, and draw the OpenGL view with black. The resize handle 
gets overdrawn. To make it visible, is there any other way than to draw the 
handle manually with OpenGL?

Regards,
Henri Häkkinen

___

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: [iPhone] UINavigationController and UINavigationBar

2009-12-08 Thread Duccio

 On Dec 8, 2009, at 3:51 PM, Mike Abdullah wrote:
 
 Other alternatives:
 
 - Subclass UINavigationController to return a custom view from 
 -navigationBar.
 - Add a custom subview to the nav bar to do your drawing.
 
 I recommend neither of these. It's already been brought up that 
 UINavigationController shouldn't be subclassed, and it isn't meant as a 
 container for arbitrary views, either. If you really aren't satisfied with 
 using a tint color for the background, file an ER asking for an API to 
 provide a background image.
 
 Final other option then, +[UIColor colorWithPatternImage:] and set that as 
 the tint.
 

I said when I read: great workaround! But does not work, the Navigation Bar is 
black:

self.navigationController.navigationBar.tintColor = [UIColor 
colorWithPatternImage:[UIImage imageNamed:@image.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: Customize the line's color that separates the window content from the title bar?

2009-12-08 Thread Rob Keniger

On 09/12/2009, at 5:59 AM, Michael Abendroth wrote:
 Unfortunately, when turning on the textured flag in IB, my app
 mysteriously crashes.

When you say mysteriously, what do you mean? What is the stack backtrace?

--
Rob Keniger



___

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


Mac OS 10.5 can't find xib-instantiated subclass methods

2009-12-08 Thread Jerry Krinock
All of a sudden, an app which I'm building won't display complete windows 
when running in Mac OS 10.5.  While loading a window, -awakeFromNib is not 
found for subclasses that are instantiated in a xib.  Examples:

 *** -[ContentOutlineView awakeFromNib]: unrecognized selector sent to instance 
0x1640c040 
 *** -[StarkTableColumn awakeFromNib]: unrecognized selector sent to instance 
0x166296b0 
 *** -[FindTableView awakeFromNib]: unrecognized selector sent to instance 
0x16866460
 
Now, since -awakeFromNib is implemented by NSObject, it should NEVER be 
unrecognized for any subclass of NSObject, which all of the above classes are...

ContentOutlineView : NSOutlineView
StarkTableColumn : NSTableColumn
FindTableView : NSTableView

These subclasses are implemented in a private framework which is packaged in 
the app.  Since I have Mac OS 10.5.8 on another partition, I test the same 
build, from my Builds/Debug folder, which works perfectly in 10.6.

To make sure that I'm not on drugs, I ran Steve Nygard's class-dump tool in 
10.5, and in 10.6, on the same unstripped framework executable, and BBEdit says 
the two outputs are identical.  Here's a snippet from a class-dump output:

@interface StarkTableColumn : NSTableColumn
{
NSString *userDefinedAttribute;
NSFont *userDefinedMenuFont;
}

- (void)awakeFromNib;
...

You see, class-dump says that -awakeFromNib is implemented.  (Of course, it's 
an override.)  Why can't Mac OS 10.5 find it?

The really odd thing about this is that it seems to have no trouble finding the 
subclasses themselves.  I mean, it does NOT say Can't find ContentOutlineView, 
using NSOutlineView instead.

App and framework target's Base SDK are set to Mac OS 10.5; compiler is gcc 
4.2.  The affected classes are all subclasses which I have defined in my code, 
and are instantiated in a xib.

I recently upgraded my development environment from 10.5 with Xcode 3.1 to 10.6 
with Xcode 3.2.1.  However I just retested archived builds and found that this 
was apparently not quite the cause:
   Nov 16: Version built on this day works OK.
   Nov 18: Upgraded dev Mac from 10.5 to 10.6.
   Nov 23: Version built on this day work OK.
   Nov 29: Version built on this day is Bad.
   Dec 07: Version built on this day is Bad.

Any guesses as to what might I have done to cause this disaster?

Thank you,

Jerry Krinock___

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: Mac OS 10.5 can't find xib-instantiated subclass methods

2009-12-08 Thread Kyle Sluder

On Dec 8, 2009, at 6:22 PM, Jerry Krinock je...@ieee.org wrote:

Now, since -awakeFromNib is implemented by NSObject, it should NEVER  
be unrecognized for any subclass of NSObject, which all of the above  
classes are...


Not before 10.6 it isn't.

--Kyle Sluder
___

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: Best way to hook into the run loop?

2009-12-08 Thread Graham Cox
For those who were helping out with my problems with Undo, and others who might 
be interested, I've released my Undo implementation here: 
http://apptree.net/gcundomanager.htm

I'd be interested to hear any feedback, criticism, suggestions, praise or 
whatever.

In adding this class to my app, all the problems I was having have simply 
vanished, which is a great relief. The slightly more surprising thing is that 
it also quickly helped me to reveal some errors in the logic of how certain 
parts of the app were doing undo-type things, because I could quickly dump the 
undo stacks to the log and also single-step through each operation. For that 
alone, this would have been worth doing.

So, thanks for all your help everyone, and I hope this small contribution to 
the Cocoa community will be useful.

--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: Improving speed of NSCollectionView scrolling

2009-12-08 Thread PCWiz
Ok, I think I've solved this problem. Corbin, you're right, the problem is too 
many subviews.

What I did to counter this problem is to actually draw most images/text in my 
prototype NSView subclass rather than using subviews like NSImageView and 
NSTextField. This yielded a pretty noticeable speed increase. 

Hope this helps anyone else having similar issues. Key point: just do the 
drawing yourself.

On 2009-12-08, at 5:31 PM, Corbin Dunn wrote:

 
 On Dec 8, 2009, at 3:40 PM, PCWiz wrote:
 
 Hi,
 
 I am using NSCollectionView for a project in which the collection view is 
 populated with about 200 items, each containing about 4 subviews (image 
 view, and a few text fields).
 
 You may want to consider using a different view. NSCollectionView does not do 
 any special things for views that aren't visible, and you get one view for 
 each item. So, in this case, you have at least 5 * 200 = 1000 views. That's a 
 lot. Try IKImageBrowserView or NSTableView/NSOutlineView.
 
 corbin
 
 

___

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


Issue with Input method using IMK

2009-12-08 Thread bhanu
Hi,

I am trying to develop an input method using IMKit approach by implementing the 
below. 
-(BOOL)inputText:(NSString*) string key:(NSInteger)keyCode 
modifiers:(NSUInteger)flags client:(id)sender


I took the IMK sample available at ADC, and understood the flow by installing 
and dumping the traces to a file (I had some problems while setting up remote 
debugging). After I customized the sample to implement the above and replacing 
the app, I am no longer seeing the calls to inputText. I only see calls to 
setValue (which is called when the selection is changed). The OS is snow 
leopard.

Is this a known issue? Am I doing something wrong?

Thanks for your help!
___

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


Deleting entire sections in UITableView edit mode

2009-12-08 Thread Michael Gardner
I'm creating a UITableView in which users should be able to (among other 
things) delete not only single rows, but entire sections. When the table is put 
into edit mode, I would like to show a control in each section header that will 
allow deletion of the associated section.

How hard is this going to be (in particular, getting the custom edit controls' 
appearance and animations to match those of the existing edit controls)? Has 
anyone done anything similar before? If it turns out to be too hard, I may just 
give up and put an always-visible delete this section button in the header or 
footer of each section.

-Michael___

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: Mac OS 10.5 can't find xib-instantiated subclass methods

2009-12-08 Thread Jerry Krinock

On 2009 Dec 08, at 18:36, Kyle Sluder wrote:

 Now, since -awakeFromNib is implemented by NSObject
 
 Not before 10.6 it isn't.

Thank you, Kyle.  That was the problem, and since the runtime doesn't 
distinguish between subclass and superclass, the exception logged sent me 
looking down the wrong track.

I believe that, sometime between Nov 18 and Nov 29, I noticed that my 
-awakeFromNib implementations were not invoking super, and ignored my 
grandmother's advice to never touch working code.

Correct way:

- (void)awakeFromNib {
// Per Discussion in documentation of -[NSObject respondsToSelector:].
// the superclass name in the following must be hard-coded.
if ([NSTableView instancesRespondToSelector:@selector(awakeFromNib)]) {
[super awakeFromNib] ;
}

...
}

___

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: Unable to write in InfoPlist.strings file from cpp

2009-12-08 Thread Parimal Das
Thanks a lot Greg.
Interpret as UTF8 solved the problem.

-Parimal Das

On Tue, Dec 8, 2009 at 8:18 PM, Greg Parker gpar...@apple.com wrote:

 On Dec 8, 2009, at 5:25 AM, Parimal Das wrote:
  I am trying to write CFBundleGetInfoString into InfoPlist.strings
 from
  cpp code and It is writing successfully.
  But when i use the InfoPlist.strings in xcode, it gives me a build error
  /usr/bin/iconv: English.lproj/InfoPlist.strings:1:82: incomplete
 character
  or shift sequence
 
  Now if i open the .strings file in dashcode (or any other text editor),
 it
  shows me the required text correctly, but when i open the same in xcode -
 it
  show something similar to chinese/japanese script.
 
  Dashcode shows: CFBundleGetInfoString = bla bla bla;
  Xcode shows: 屲屮䍆䉵湤汥䝥瑉湦潓瑲楮朠㴠≍慩求牯睳敲′⸳⁐䕎呁Ⱐ䍯

 Xcode is probably reading InfoPlist.strings with the wrong text encoding.
 Most likely, your code wrote UTF-8 that Xcode is reading as UTF-16.

 Open your project in Xcode, Get Info on each InfoPlist.strings file, and
 set General  File Encoding to the encoding your code writes. When Xcode
 asks what to do with the existing file, choose Reinterpret.


 --
 Greg Parker gpar...@apple.com Runtime Wrangler





-- 
--
Warm Regards,

Parimal Das
Webyog Softworks
___

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


Cocoaheads Lake Forest (92630) meeting Wed 12/9/2009 at 7 pm on Detecting Memory Leaks with Instruments

2009-12-08 Thread Scott Ellsworth
CocoaHeads Lake Forest will be meeting on the second Wednesday of the
month.  We will be meeting at the Orange County Public Library (El
Toro) community room, 24672 Raymond Way, Lake Forest, CA 92630

Please join us from 7pm to 9pm on Wednesday, 12/9.

Peter Hosey will be speaking on hunting memory leaks with Instruments.
 Memory leaks are one of the more persistent problems facing Cocoa
developers; finding them will make your users happier and your
programs more stable.

Check out his blog at http://boredzo.org/blog/ for a variety of
articles, including a pre-meeting dinner suggestion for this week.

We are planning our topics for next year.  If you are able and willing
to speak on Core Animation, Open GL, Mac Open Source, or Cocoa 101 for
either iPhone or Mac, please contact me.

(Personal note - Google Irvine is hiring - feel free to chat with me
after the meeting if you are interested.)

Bring your comments, your books, and your bugs, and we will leap right in.

As always, details and the upcoming meeting calendar can be found at
the cocoaheads web site at www.cocoaheads.org in the Lake Forest, CA
section.
___

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


  1   2   >