Re: Memory leak when using new MPMoviePlayerController notifications

2010-08-29 Thread Graham Cox

On 28/08/2010, at 11:11 PM, Michael Crawford wrote:

 My question is this: is my technique for releasing the only reference I have 
 to the movie controller, which is the notification object, valid?  NOTE: This 
 is the new 3.2 SDK movie player controller.
 
 - (BOOL)application:(UIApplication*)application 
 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
 {
// start playback of intro movie and watch for notification of playback 
 completion
MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc] 
 initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] 
 pathForResource:@intro_movie ofType:@mp4]]];


You are tying yourself in knots thinking about how the notification center 
might or might not be holding references to 'moviePlayer'. It's much simpler - 
you created it (alloc + init) therefore you own it. It is thus up to you to 
release it when you've finished with it.

Don't think in terms of incrementing and decrementing retain counts, just think 
about who owns what.

I wouldn't rely on NSNotificationCenter taking ownership of this object - in 
fact it's almost certain it does not (though it's an implementation detail 
you're not party to). The safest, sanest, conventional thing to do is to hold a 
reference to the player as an ivar and release it when it finishes. Why go to a 
lot of trouble to avoid doing that? Its cost is minute.

--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: NSString / NSURL

2010-08-29 Thread Amy Heavey

I still get an error:

2010-08-29 09:13:46.337 ishop[2766:10b] *** -[NSURL  
URLByAppendingPathComponent:]: unrecognized selector sent to instance  
0xc6356a0
2010-08-29 09:13:46.337 ishop[2766:10b] *** -[NSURL  
URLByAppendingPathComponent:]: unrecognized selector sent to instance  
0xc6356a0


Many Thanks

Amy



On 28 Aug 2010, at 4:08PM, David Duncan wrote:


On Aug 28, 2010, at 8:04 AM, Amy Heavey wrote:


Sorry duh!

2010-08-28 15:55:27.961 ishop[1920:10b] *** -[NSURL  
stringByAppendingPathComponent:]: unrecognized selector sent to  
instance 0x16fbe0
2010-08-28 15:55:27.961 ishop[1920:10b] *** -[NSURL  
stringByAppendingPathComponent:]: unrecognized selector sent to  
instance 0x16fbe0


defaultImageLocation is an NSURL* (because thats what you created at  
the top of the method). You want to use - 
URLByAppendingPathComponent: with it.

--
David Duncan

___

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/home%40willowtreecrafts.co.uk

This email sent to h...@willowtreecrafts.co.uk


___

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: NSString / NSURL

2010-08-29 Thread Roland King
What OS are you building for?

On 29-Aug-2010, at 4:14 PM, Amy Heavey wrote:

 I still get an error:
 
 2010-08-29 09:13:46.337 ishop[2766:10b] *** -[NSURL 
 URLByAppendingPathComponent:]: unrecognized selector sent to instance 
 0xc6356a0
 2010-08-29 09:13:46.337 ishop[2766:10b] *** -[NSURL 
 URLByAppendingPathComponent:]: unrecognized selector sent to instance 
 0xc6356a0
 
 Many Thanks
 
 Amy
 
 
 
 On 28 Aug 2010, at 4:08PM, David Duncan wrote:
 
 On Aug 28, 2010, at 8:04 AM, Amy Heavey wrote:
 
 Sorry duh!
 
 2010-08-28 15:55:27.961 ishop[1920:10b] *** -[NSURL 
 stringByAppendingPathComponent:]: unrecognized selector sent to instance 
 0x16fbe0
 2010-08-28 15:55:27.961 ishop[1920:10b] *** -[NSURL 
 stringByAppendingPathComponent:]: unrecognized selector sent to instance 
 0x16fbe0
 
 defaultImageLocation is an NSURL* (because thats what you created at the top 
 of the method). You want to use -URLByAppendingPathComponent: with it.
 --
 David Duncan
 
 ___
 
 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/home%40willowtreecrafts.co.uk
 
 This email sent to h...@willowtreecrafts.co.uk
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSString / NSURL

2010-08-29 Thread Amy Heavey

10.5 i386,

On 29 Aug 2010, at 9:21AM, Roland King wrote:


What OS are you building for?

On 29-Aug-2010, at 4:14 PM, Amy Heavey wrote:


I still get an error:

2010-08-29 09:13:46.337 ishop[2766:10b] *** -[NSURL  
URLByAppendingPathComponent:]: unrecognized selector sent to  
instance 0xc6356a0
2010-08-29 09:13:46.337 ishop[2766:10b] *** -[NSURL  
URLByAppendingPathComponent:]: unrecognized selector sent to  
instance 0xc6356a0


Many Thanks

Amy



On 28 Aug 2010, at 4:08PM, David Duncan wrote:


On Aug 28, 2010, at 8:04 AM, Amy Heavey wrote:


Sorry duh!

2010-08-28 15:55:27.961 ishop[1920:10b] *** -[NSURL  
stringByAppendingPathComponent:]: unrecognized selector sent to  
instance 0x16fbe0
2010-08-28 15:55:27.961 ishop[1920:10b] *** -[NSURL  
stringByAppendingPathComponent:]: unrecognized selector sent to  
instance 0x16fbe0


defaultImageLocation is an NSURL* (because thats what you created  
at the top of the method). You want to use - 
URLByAppendingPathComponent: with it.

--
David Duncan

___

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/home%40willowtreecrafts.co.uk

This email sent to h...@willowtreecrafts.co.uk


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to r...@rols.org


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/home%40willowtreecrafts.co.uk

This email sent to h...@willowtreecrafts.co.uk


___

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: NSString / NSURL

2010-08-29 Thread Roland King
and when you look at the documentation for that method it was available 
starting with which OS version? 

convert your NSURL into an NSString, then use stringByAppendingPathComponent 
and convert it back to an NSURL again. Or use the string-based file methods 
instead. 

On 29-Aug-2010, at 4:22 PM, Amy Heavey wrote:

 10.5 i386,
 
 On 29 Aug 2010, at 9:21AM, Roland King wrote:
 
 What OS are you building for?
 
 On 29-Aug-2010, at 4:14 PM, Amy Heavey wrote:
 
 I still get an error:
 
 2010-08-29 09:13:46.337 ishop[2766:10b] *** -[NSURL 
 URLByAppendingPathComponent:]: unrecognized selector sent to instance 
 0xc6356a0
 2010-08-29 09:13:46.337 ishop[2766:10b] *** -[NSURL 
 URLByAppendingPathComponent:]: unrecognized selector sent to instance 
 0xc6356a0
 
 Many Thanks
 
 Amy
 
 
 
 On 28 Aug 2010, at 4:08PM, David Duncan wrote:
 
 On Aug 28, 2010, at 8:04 AM, Amy Heavey wrote:
 
 Sorry duh!
 
 2010-08-28 15:55:27.961 ishop[1920:10b] *** -[NSURL 
 stringByAppendingPathComponent:]: unrecognized selector sent to instance 
 0x16fbe0
 2010-08-28 15:55:27.961 ishop[1920:10b] *** -[NSURL 
 stringByAppendingPathComponent:]: unrecognized selector sent to instance 
 0x16fbe0
 
 defaultImageLocation is an NSURL* (because thats what you created at the 
 top of the method). You want to use -URLByAppendingPathComponent: with it.
 --
 David Duncan
 
 ___
 
 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/home%40willowtreecrafts.co.uk
 
 This email sent to h...@willowtreecrafts.co.uk
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.org
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/home%40willowtreecrafts.co.uk
 
 This email sent to h...@willowtreecrafts.co.uk
 

___

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: NSString / NSURL

2010-08-29 Thread Graham Cox

On 29/08/2010, at 10:14 AM, Amy Heavey wrote:

 I still get an error:


On what line?

Looking at the code you have mixed string paths and URLs. Pick one or the other 
and use it consistently. While string paths are becoming deprecated in favour 
of URLs, it might be easier to just use string paths initially to get it 
working and then convert to URLs throughout afterwards.

For example, [NSOpenPanel filenames] is deprecated, as it returns the selected 
files as strings. Use [NSOpenPanel URLs] if you want to use URLs. Similarly for 
[NSFileManager copyItemAtPath:toPath:error] use [NSFileManager 
copyItemAtURL:toURL:error].

Mixing two different representations of a file path is what is causing you 
problems here. Be consistent.

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


Non full screen video on iPhone

2010-08-29 Thread Nathan Day
Is it possible to have none full screen video on the iPhone, I have try to just 
get a demo app going at the moment, I tried using a UIWebView with a video tag 
that that doesn't start playing until it becomes full screen. Any sample 
projects would be appreciated.

Nathan Day
Software Engineer
mobile: +61 (0)4 3863 2407
home page:  http://homepage.mac.com/nathan_day/







___

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: Non full screen video on iPhone

2010-08-29 Thread Roland King
try the documentation for MPMoviePlayerController


On 29-Aug-2010, at 5:06 PM, Nathan Day wrote:

 Is it possible to have none full screen video on the iPhone, I have try to 
 just get a demo app going at the moment, I tried using a UIWebView with a 
 video tag that that doesn't start playing until it becomes full screen. Any 
 sample projects would be appreciated.
 
 Nathan Day
 Software Engineer
 mobile:   +61 (0)4 3863 2407
 home page:http://homepage.mac.com/nathan_day/
 
 
 
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSString / NSURL

2010-08-29 Thread Amy Heavey
Thanks everyone, I've been looking at everything and still can't quite  
get my head round it, basically all I want to do is copy a selected  
file to a new location.


I'm using a coredata app, so I was trying to follow the 'default' code  
provided, but I'm compiling for 10.5 and it seems there's a bit of  
flux between string based paths and urls.


Is there sample code / tutorial somewhere I'm missing?

This is what I've got at the moment, but it's still mixing URLs and  
strings, I've tried just using strings, but the  
applicationSupportFolder returns a string, which then is immutable so  
I can't add to it?


- (IBAction)selectImageFile:(id)sender;
{
// Create the File Open Dialog class.
NSOpenPanel* openDlg = [NSOpenPanel openPanel];

// Enable the selection of files in the dialog.
[openDlg setCanChooseFiles:YES];

// process the files.
if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton )
{
// Get an array containing the full filenames of all
// files and directories selected.
NSArray* files = [openDlg filenames];

// process file
NSObject *Product;
Product = [[Products selectedObjects] objectAtIndex:0];
NSString* filePath = [files objectAtIndex:0];

NSString* fileName= [filePath lastPathComponent];
		NSURL* imagePath = [NSURL fileURLWithPath: [[self  
applicationSupportFolder] stringByAppendingPathComponent: @images]];
--Here are 2 warnings that NSURL may not respond to  
stringByAppendingPathComponent		

[imagePath stringByAppendingPathComponent:fileName];
NSLog(@Old Path is %@  New Path is %@, filePath, imagePath);
		[[ NSFileManager defaultManager ] copyItemAtPath:filePath  
toPath:imagePath error:nil];



//[Product setValue:imagePath forKey:@productImage];


}

Many Thanks

Amy



On 29 Aug 2010, at 9:30AM, Graham Cox wrote:



On 29/08/2010, at 10:14 AM, Amy Heavey wrote:


I still get an error:



On what line?

Looking at the code you have mixed string paths and URLs. Pick one  
or the other and use it consistently. While string paths are  
becoming deprecated in favour of URLs, it might be easier to just  
use string paths initially to get it working and then convert to  
URLs throughout afterwards.


For example, [NSOpenPanel filenames] is deprecated, as it returns  
the selected files as strings. Use [NSOpenPanel URLs] if you want to  
use URLs. Similarly for [NSFileManager copyItemAtPath:toPath:error]  
use [NSFileManager copyItemAtURL:toURL:error].


Mixing two different representations of a file path is what is  
causing you problems here. Be consistent.


--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/home%40willowtreecrafts.co.uk

This email sent to h...@willowtreecrafts.co.uk


___

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: NSString / NSURL

2010-08-29 Thread Roland King
NSFileManager copyItemAtPath:toPath: takes two NSString's so you can't use an 
NSURL anyway. In fact nothing in that code needs an NSURL. 

Get rid of that NSURL stuff (note: typed in mail)

NSString *imagePath = [ [ [ self applicationSupportFolder ] 
stringByAppendingPathComponent:@images ] 
stringByAppendingPathComponent:fileName ];

then just use the imagePath. 

On 29-Aug-2010, at 5:23 PM, Amy Heavey wrote:

 Thanks everyone, I've been looking at everything and still can't quite get my 
 head round it, basically all I want to do is copy a selected file to a new 
 location.
 
 I'm using a coredata app, so I was trying to follow the 'default' code 
 provided, but I'm compiling for 10.5 and it seems there's a bit of flux 
 between string based paths and urls.
 
 Is there sample code / tutorial somewhere I'm missing?
 
 This is what I've got at the moment, but it's still mixing URLs and strings, 
 I've tried just using strings, but the applicationSupportFolder returns a 
 string, which then is immutable so I can't add to it?
 
 - (IBAction)selectImageFile:(id)sender;
 {
   // Create the File Open Dialog class.
   NSOpenPanel* openDlg = [NSOpenPanel openPanel];
   
   // Enable the selection of files in the dialog.
   [openDlg setCanChooseFiles:YES];
 
   // process the files.
   if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton )
   {
   // Get an array containing the full filenames of all
   // files and directories selected.
   NSArray* files = [openDlg filenames];
   
   // process file
   NSObject *Product;
   Product = [[Products selectedObjects] objectAtIndex:0];
   NSString* filePath = [files objectAtIndex:0];
   
   NSString* fileName= [filePath lastPathComponent];
   NSURL* imagePath = [NSURL fileURLWithPath: [[self 
 applicationSupportFolder] stringByAppendingPathComponent: @images]];
 --Here are 2 warnings that NSURL may not respond to 
 stringByAppendingPathComponent  
   [imagePath stringByAppendingPathComponent:fileName];
   NSLog(@Old Path is %@  New Path is %@, filePath, imagePath);
   [[ NSFileManager defaultManager ] copyItemAtPath:filePath 
 toPath:imagePath error:nil];
   
   
   //[Product setValue:imagePath forKey:@productImage];
   
   
   }
 
 Many Thanks
 
 Amy
 
 
 
 On 29 Aug 2010, at 9:30AM, Graham Cox wrote:
 
 
 On 29/08/2010, at 10:14 AM, Amy Heavey wrote:
 
 I still get an error:
 
 
 On what line?
 
 Looking at the code you have mixed string paths and URLs. Pick one or the 
 other and use it consistently. While string paths are becoming deprecated in 
 favour of URLs, it might be easier to just use string paths initially to get 
 it working and then convert to URLs throughout afterwards.
 
 For example, [NSOpenPanel filenames] is deprecated, as it returns the 
 selected files as strings. Use [NSOpenPanel URLs] if you want to use URLs. 
 Similarly for [NSFileManager copyItemAtPath:toPath:error] use [NSFileManager 
 copyItemAtURL:toURL:error].
 
 Mixing two different representations of a file path is what is causing you 
 problems here. Be consistent.
 
 --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/home%40willowtreecrafts.co.uk
 
 This email sent to h...@willowtreecrafts.co.uk
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSString / NSURL

2010-08-29 Thread Amy Heavey

Thank You!

I had been trying to do that but couldn't get the brackets right,  
sometimes you just need to start a fresh line instead of trying to  
edit don't you.


That's working now and is perfect,

Thank you for your time and help everyone,
Many Thanks

Amy

On 29 Aug 2010, at 10:43AM, Roland King wrote:

NSFileManager copyItemAtPath:toPath: takes two NSString's so you  
can't use an NSURL anyway. In fact nothing in that code needs an  
NSURL.


Get rid of that NSURL stuff (note: typed in mail)

NSString *imagePath = [ [ [ self applicationSupportFolder ]  
stringByAppendingPathComponent:@images ]  
stringByAppendingPathComponent:fileName ];


then just use the imagePath.

On 29-Aug-2010, at 5:23 PM, Amy Heavey wrote:

Thanks everyone, I've been looking at everything and still can't  
quite get my head round it, basically all I want to do is copy a  
selected file to a new location.


I'm using a coredata app, so I was trying to follow the 'default'  
code provided, but I'm compiling for 10.5 and it seems there's a  
bit of flux between string based paths and urls.


Is there sample code / tutorial somewhere I'm missing?

This is what I've got at the moment, but it's still mixing URLs and  
strings, I've tried just using strings, but the  
applicationSupportFolder returns a string, which then is immutable  
so I can't add to it?


- (IBAction)selectImageFile:(id)sender;
{
// Create the File Open Dialog class.
NSOpenPanel* openDlg = [NSOpenPanel openPanel];

// Enable the selection of files in the dialog.
[openDlg setCanChooseFiles:YES];

// process the files.
if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton )
{
// Get an array containing the full filenames of all
// files and directories selected.
NSArray* files = [openDlg filenames];

// process file
NSObject *Product;
Product = [[Products selectedObjects] objectAtIndex:0];
NSString* filePath = [files objectAtIndex:0];

NSString* fileName= [filePath lastPathComponent];
		NSURL* imagePath = [NSURL fileURLWithPath: [[self  
applicationSupportFolder] stringByAppendingPathComponent:  
@images]];
--Here are 2 warnings that NSURL may not respond to  
stringByAppendingPathComponent		

[imagePath stringByAppendingPathComponent:fileName];
NSLog(@Old Path is %@  New Path is %@, filePath, imagePath);
		[[ NSFileManager defaultManager ] copyItemAtPath:filePath  
toPath:imagePath error:nil];



//[Product setValue:imagePath forKey:@productImage];


}

Many Thanks

Amy



On 29 Aug 2010, at 9:30AM, Graham Cox wrote:



On 29/08/2010, at 10:14 AM, Amy Heavey wrote:


I still get an error:



On what line?

Looking at the code you have mixed string paths and URLs. Pick one  
or the other and use it consistently. While string paths are  
becoming deprecated in favour of URLs, it might be easier to just  
use string paths initially to get it working and then convert to  
URLs throughout afterwards.


For example, [NSOpenPanel filenames] is deprecated, as it returns  
the selected files as strings. Use [NSOpenPanel URLs] if you want  
to use URLs. Similarly for [NSFileManager  
copyItemAtPath:toPath:error] use [NSFileManager  
copyItemAtURL:toURL:error].


Mixing two different representations of a file path is what is  
causing you problems here. Be consistent.


--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/home%40willowtreecrafts.co.uk

This email sent to h...@willowtreecrafts.co.uk


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to r...@rols.org


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/home%40willowtreecrafts.co.uk

This email sent to h...@willowtreecrafts.co.uk


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the 

Re: CGLayer resolution on iPhone with Retina display

2010-08-29 Thread Alex Kac
Ah, I just read the Layer part and didn’t think of a CGLayer. You are right - a 
CGLayer has nothing in common. That’s what I get for reading too quickly.

On Aug 28, 2010, at 9:18 PM, Matt Neuburg wrote:

 
 On Aug 28, 2010, at 1:37 PM, Alex Kac wrote:
 
 I believe you need to set the scale of the layer to the scale of the device. 
 Here is how we do it where appContentScaleFactor is a global variable we 
 store the scale from at startup:
 
  if ([[UIScreen mainScreen] respondsToSelector: @selector(scale)])
  appContentScaleFactor = [[UIScreen mainScreen] scale];
 
 
  if ([mainLayer respondsToSelector: 
 @selector(setContentsScale:)])
  mainLayer.contentsScale = appContentScaleFactor;
 
 
 Sure, but a CGLayer has no contentsScale properties (or any other 
 properties). A CGLayer isn't a CALayer... In fact I'm not sure they have 
 anything in common. m.
 
 
 
 
 On Aug 28, 2010, at 3:22 PM, Matt Neuburg wrote:
 
 In my UIView's drawRect: I derive a CGLayer from the current context, draw
 into it, and then draw the layer into the context (the view). This still
 works on iPhone with a Retina display, but the drawing is blocky. You can
 see the problem perfectly with Apple's own example code (DrawFlag) in the
 CGLayer Drawing page of the Quartz 2D Programming Guide - the stars in the
 flag are blocky.
 
 I can work around the problem for a double-resolution screen by creating a
 CGLayer twice the size I need, applying a doubling scale transform, drawing
 as before into the CGLayer, and then drawing the CGLayer into my view's
 context scaled back down again.
 
 But I feel I shouldn't have to do this. Given that the documentation claims
 that a CGLayer has all the characteristics of the graphics context [from
 which it is derived] - its resolution, colorspace, and graphics state
 settings, might we call this a bug?
 
 m.
 
 -- 
 matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
 pantes anthropoi tou eidenai oregontai phusei
 Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
 AppleScript: the Definitive Guide, 2nd edition
 http://www.tidbits.com/matt/default.html#applescriptthings
 Take Control of Exploring  Customizing Snow Leopard
 http://tinyurl.com/kufyy8
 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
 TidBITS, Mac news and reviews since 1990, http://www.tidbits.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/alex%40webis.net
 
 This email sent to a...@webis.net
 
 Alex Kac - President and Founder
 Web Information Solutions, Inc.
 
 Forgiveness is not an occasional act: it is a permanent attitude. 
 -- Dr. Martin Luther King
 
 
 
 
 

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

I am not young enough to know everything.
--Oscar Wilde




___

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


NSBrowser drawing glitch

2010-08-29 Thread Sebastian Morsch
Hi!

NSBrowser leaves an annoying 2-pixel gap between the right edge of a 
highlighted browser cell and the vertical column slider. Picture:
http://dl.dropbox.com/u/86388/NSBrowserDrawingGlitch.png

It does go away when the column width is changed live by the user, but 
reappears when the cell is redrawn.
It's not there when the browser shows separators (setSeparateColumns:YES).

I am using a regular NSBrowser, pulled from the IB palette, without any fancy 
stuff done to it.

Any ideas why that is? Is it a common problem?

Thanks!
Sebastian


___

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: NSString / NSURL

2010-08-29 Thread Greg Guerin

Amy Heavey wrote:

... I've tried just using strings, but the applicationSupportFolder  
returns a string, which then is immutable so I can't add to it?


There's a significant misconception lurking here.

None of the NSString methods for appending or deleting actually  
modify the NSString they are applied to.  A new NSString instance is  
created that contains a copy of the original's contents plus whatever  
contents is to be appended, or minus the contents to be deleted, or  
with some parts replaced, or whatever the operation is.  The original  
NSString is never modified in any way.


The methods whose name starts with string, as in  
stringByAppendingString, return an NSString object that the caller  
does not own.  See the Memory Management Guide on ownership for the  
consequences (i.e. the uses of retain and release).


Also see the NSString reference doc, and read the descriptions under  
stringByAppendingString and others.  Example:


Returns a new string made by appending a given string to the receiver

The critical words are a new string and made by.

The same is true of NSMutableString, when those same methods are  
applied.  A new NSString is made that contains the altered copy of  
the contents, and that instance is returned.


The only NSMutableString methods that modify the target object are  
the ones listed under Modifying a String in the NSMutableString  
reference doc.  All the methods inherited from NSString are non- 
modifying.


http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ 
Foundation/Classes/NSMutableString_Class/Reference/Reference.html


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


Re: CGLayer resolution on iPhone with Retina display

2010-08-29 Thread David Duncan
I would recommend you file a bug.

--
David Duncan

On Aug 29, 2010, at 9:38 AM, Matt Neuburg m...@tidbits.com wrote:

 On or about 8/28/10 9:31 PM, thus spake David Duncan
 david.dun...@apple.com:
 
 In the case of iOS for example, caching contents to CGLayers is rarely useful
 because it is rarely useful to use a software cache – it is usually far more
 useful to use a hardware cache, which means CALayer or UIView, not CGLayer.
 
 I bow to all you say; still the question remains whether, taken
 dispassionately and in the abstract, it might be a useful behavior if
 calling CGLayerCreateWithContext() would cause the resulting CGLayer to have
 the resolution of the context from which it is created, as advertised, so
 that drawing back into the same context with e.g. CGContextDrawLayerAtPoint
 would not cause the ultimate drawing to have half the resolution on the
 iPhone 4?
 
 Just to repeat, the flag-drawing example on this page:
 
 http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Con
 ceptual/drawingwithquartz2d/dq_layers/dq_layers.html
 
 ...is Apple's own, and behaves undesirably when the screen is
 double-resolution, visibly drawing the flag's stars in single resolution. m.
 
 -- 
 matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
 pantes anthropoi tou eidenai oregontai phusei
 Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
 AppleScript: the Definitive Guide, 2nd edition
 http://www.tidbits.com/matt/default.html#applescriptthings
 Take Control of Exploring  Customizing Snow Leopard
 http://tinyurl.com/kufyy8
 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
 TidBITS, Mac news and reviews since 1990, http://www.tidbits.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: CGLayer resolution on iPhone with Retina display

2010-08-29 Thread Matt Neuburg
On or about 8/28/10 9:31 PM, thus spake David Duncan
david.dun...@apple.com:

 it is usually far more
 useful to use a hardware cache, which means CALayer or UIView, not CGLayer.

Sorry to keep coming back to this, but the documentation implies that
CGLayer *is* a hardware cache - that's why I was using it. For example, the
documentation says:

 Before you call this or any routine that uses CGLayer objects, you must check
 to make sure that the system is running Mac OS X v10.4 or later and has a
 graphics card that supports using CGLayer objects

This suggests that CGLayer is implemented in hardware; otherwise surely the
check for a proper graphics card wouldn't be necessary? But perhaps I'm
misunderstanding m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring  Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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: CGLayer resolution on iPhone with Retina display

2010-08-29 Thread David Duncan
On Aug 29, 2010, at 11:21 AM, Matt Neuburg wrote:

 On or about 8/28/10 9:31 PM, thus spake David Duncan
 david.dun...@apple.com:
 
 it is usually far more
 useful to use a hardware cache, which means CALayer or UIView, not CGLayer.
 
 Sorry to keep coming back to this, but the documentation implies that
 CGLayer *is* a hardware cache - that's why I was using it. For example, the
 documentation says:

It is (potentially) a hardware cache on the desktop in certain situations. 
Nothing in CG is hardware accelerated on iOS however, and CGLayer is no 
exception.

 Before you call this or any routine that uses CGLayer objects, you must check
 to make sure that the system is running Mac OS X v10.4 or later and has a
 graphics card that supports using CGLayer objects
 
 This suggests that CGLayer is implemented in hardware; otherwise surely the
 check for a proper graphics card wouldn't be necessary? But perhaps I'm
 misunderstanding m.


If you require hardware acceleration of CGLayer objects perhaps, but to simply 
use CGLayers requires no such check. This would be a bug in the documentation.

Much of the shared documentation between iOS and Mac OS X will contain 
information that is incorrect for one platform or another. We strive to point 
out where information applies to only one platform or another, but this is an 
ongoing effort.
--
David Duncan

___

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: CGLayer resolution on iPhone with Retina display

2010-08-29 Thread Ken Ferry
On Sun, Aug 29, 2010 at 2:10 PM, David Duncan david.dun...@apple.comwrote:

 On Aug 29, 2010, at 11:21 AM, Matt Neuburg wrote:

  On or about 8/28/10 9:31 PM, thus spake David Duncan
  david.dun...@apple.com:
 
  it is usually far more
  useful to use a hardware cache, which means CALayer or UIView, not
 CGLayer.
 
  Sorry to keep coming back to this, but the documentation implies that
  CGLayer *is* a hardware cache - that's why I was using it. For example,
 the
  documentation says:

 It is (potentially) a hardware cache on the desktop in certain situations.
 Nothing in CG is hardware accelerated on iOS however, and CGLayer is no
 exception.


Additionally, I don't think it's actually hardware accelerated on the
desktop either.

In practice at the moment, a CGLayer is basically a CGImage together with a
CGBitmapContext.  I can think of case where something different happens, but
that case still doesn't use the GPU.

-Ken
Cocoa Frameworks



  Before you call this or any routine that uses CGLayer objects, you must
 check
  to make sure that the system is running Mac OS X v10.4 or later and has
 a
  graphics card that supports using CGLayer objects
 
  This suggests that CGLayer is implemented in hardware; otherwise surely
 the
  check for a proper graphics card wouldn't be necessary? But perhaps I'm
  misunderstanding m.


 If you require hardware acceleration of CGLayer objects perhaps, but to
 simply use CGLayers requires no such check. This would be a bug in the
 documentation.

 Much of the shared documentation between iOS and Mac OS X will contain
 information that is incorrect for one platform or another. We strive to
 point out where information applies to only one platform or another, but
 this is an ongoing effort.
 --
 David Duncan

 ___

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

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


Overriding -release to break retain cycle. Was: Doc for -release not quite true

2010-08-29 Thread Jerry Krinock

On 2010 Aug 23, at 19:02, Daniel DeCovnick wrote:

 But it doesn't really matter since you should never be calling dealloc except 
 from release or dealloc (as [super dealloc];) anyway.

No, I haven't called -dealloc for quite a few years  :)

Actually, I was studying Uli Kusterer's old UKKQueue.  One of his instances 
detaches a secondary thread with the instance itself as target, creating a kind 
of retain cycle:  The secondary thread won't exit until the instance is 
deallocced, and the instance won't be deallocced until the secondary thread 
exits.  To fix this, he overrode -release, and messages (via ivar) the 
secondary thread to exit when the pre-release retainCount == 2.  I believe it 
is a pretty neat trick, but couldn't understand it until I corrected Apple's 
documentation of -release.

Document Feedback has been submitted on -release.

___

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: Overriding -release to break retain cycle. Was: Doc for -release not quite true

2010-08-29 Thread Michael Ash
On Sun, Aug 29, 2010 at 5:58 PM, Jerry Krinock je...@ieee.org wrote:

 On 2010 Aug 23, at 19:02, Daniel DeCovnick wrote:

 But it doesn't really matter since you should never be calling dealloc 
 except from release or dealloc (as [super dealloc];) anyway.

 No, I haven't called -dealloc for quite a few years  :)

 Actually, I was studying Uli Kusterer's old UKKQueue.  One of his instances 
 detaches a secondary thread with the instance itself as target, creating a 
 kind of retain cycle:  The secondary thread won't exit until the instance is 
 deallocced, and the instance won't be deallocced until the secondary thread 
 exits.  To fix this, he overrode -release, and messages (via ivar) the 
 secondary thread to exit when the pre-release retainCount == 2.  I believe it 
 is a pretty neat trick, but couldn't understand it until I corrected Apple's 
 documentation of -release.

A side note: while this is an interesting and somewhat useful
technique for breaking retain cycles, it's also fragile. The problem
arises if two different pieces of code both apply this technique to
the same object, which in this case could happen if you subclass. In
that case, the retain count reaches 3 at which point the cycles need
to be broken, but since the count never drops to 2, they are not.

Much better is to avoid causing the retain cycle in the first place.
This sort of problem was what prompted me to create MAZeroingWeakRef:

http://www.mikeash.com/pyblog/introducing-mazeroingweakref.html

For this particular case, you could use an instance of
MAZeroingWeakProxy as the thread's target, and set a cleanup block
which tells the thread to exit, or there are a variety of other
possibilities which arise once you have reliable weak references
available.-

For anyone contemplating retain cycles and how to break them, I
strongly encourage you to have a look.

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


sdef NSXMLParserErrorDomain error 1549 in 10.5, PowerPC

2010-08-29 Thread Jerry Krinock
When testing my app and its command-line helper in Mac OS 10.5 on a PowerPC 
machine, I see these annoying pairs of entries in the Console Log: 

sdef error: Operation could not be completed. (NSXMLParserErrorDomain error 
1549.) 
line number: 2

I'm not sure whether or not they're related to the problem I'm trying to fix.  
The helper does send AppleScript messages to my app.  A web search shows that 
these messages are quite common, and that possibly they only occur in Mac OS 
10.5 on PowerPC.

I looked at lines 1 and 2 in my app's .sdef file (wonderfully created by Shadow 
Labs' Sdef Editor app), and find them to be exactly as specified in Apple's 
Cocoa Scripting Guide  Preparing a Scripting Definition File…

?xml version=1.0 encoding=UTF-8?
!DOCTYPE dictionary SYSTEM file://localhost/System/Library/DTDs/sdef.dtd

Then I looked into the packages of several Apple apps (Safari, Mail, etc.) on 
this old Mac, and found that, instead of .sdef files, these apps all still use 
the old .scriptTerminology and .scriptSuite files, which were depracated in Mac 
OS 10.4.  Eeek.  Well, these Console messages are not *that* annoying.

Does anyone know how to stop these messages?  Or can at least confirm that they 
are false alarms?

___

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: CGLayer resolution on iPhone with Retina display

2010-08-29 Thread Matt Neuburg
On or about 8/29/10 2:54 PM, thus spake Ken Ferry kenfe...@gmail.com:

 In practice at the moment, a CGLayer is basically a CGImage together with a
 CGBitmapContext.  I can think of case where something different happens, but
 that case still doesn't use the GPU.

Cool, once again I got the education I was after. Thx to all - m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring  Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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: Set the Cursor Position

2010-08-29 Thread Raleigh Ledet

On Aug 19, 2010, at 6:43 PM, Sherm Pendley wrote:

 On Thu, Aug 19, 2010 at 9:32 PM, Murat Konar mu...@pixar.com wrote:
 CGDisplayMoveCursorToPoint(CGDirectDisplayID display, CGPoint point);
 
 But heed the other's hints that, except for special classes of software
 (like a VNC app), software that warps the pointer's location independent of
 the mouse is much un-loved on the Mac.
 
 One such exception would be 2d or 3d graphics apps, where it's
 expected to have a tool that allows the user to click and drag to
 scale or rotate an object. When such a tool is active, one might
 respond to drag events by modifying the model to match the mouse
 movement, then warping the cursor back to its original position.

Doing that doesn't play well with absolute pointing devices like tablet. If you 
need to know how the use intended to move the cursor even though the cursor is 
pinned to the edge of the screen, use the delta values in the event.

-raleigh

 
 sherm--
 
 -- 
 Cocoa programming in Perl:
 http://camelbones.sourceforge.net
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com
 
 This email sent to le...@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: Create pinch/magnify event

2010-08-29 Thread Raleigh Ledet
You can not simulate these gestures. Please file a radar.
-raleigh

On Aug 20, 2010, at 1:42 PM, Joe Turner wrote:

 Hey,
 
 I'm trying to use CGEvent to create a pinch/magnify event, but I can't find 
 any info on how to do it. I see there's a NSEventTypeMagnify for NSEvent, but 
 the magnification factor does not seem settable. Even if it was, weird things 
 happen when you try to convert an NSEvent to a CGEvent. So, I'm wondering if 
 anyone has experience with doing this? What about for 4 finger swipes?
 
 If not, is there a way to create raw trackpad touches (pragmatically), so I 
 can recreate a pinch?
 
 Thanks!
 
 Joe
 ___
 
 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/ledet%40apple.com
 
 This email sent to le...@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: Core Data and REST

2010-08-29 Thread Chris Hanson
On Aug 28, 2010, at 10:00 AM, Andy Bell andy.b...@allbabel.com wrote:

 At a later date I want to use something like REST using JSON to be the 
 backend to Core Data in the application.  Is this going to be possible?

Core Data only has API for creating your own atomic persistent stores - that 
is, persistent stores whose entire contents are read or written at once.  This 
means it doesn't really make sense to talk about REST or JSON as a back-end 
to Core Data.

What does make sense - and is quite common - is using a Core Data SQLite 
persistent store as a local cache for data on a server, or as a local database 
synchronized (via your own mechanism) with a server.

  -- Chris
 
___

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


how do I get tracking, selection etc working with custom views in NSMenuItems?

2010-08-29 Thread Rua Haszard Morris
Hi Cocoa-dev,

I'm experimenting with using NSViews in menus, and was expecting that such 
items could continue to use Cocoa-provided implementations of mouse tracking, 
selecting an item and dismissing the menu, etc.

After a lot of experimentation, doc reading and googling I've managed to hook 
up mouse tracking somewhat correctly - by implementing the delegate method 
menu:willHighlightItem:, and ensuring my views get setNeedsDisplay:YES when 
they get un-highlighted. This seemed to work correctly but was a lot more work 
than I expected. 

More importantly, I want the NSView items to behave the same as other menu 
items - i.e. when the user selects one, by mouse or keyboard, the menu 
dismisses and actions are sent (and the item highlight flashes briefly). I 
can't work out how to get this hooked up without reinventing the wheel.

Note that my NSViews don't require mouse input - I'm just using NSView items 
for custom display, not the more complicated case displaying a control in the 
menu.

Does anyone have any good pointers regarding using NSViews in an NSMenu and 
falling back to system-provided code for tracking and selection?

thanks
Rua HM.___

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