Re: Importing to core data persistent document

2010-08-05 Thread Gideon King
Thanks Quincey - of course I can do exactly what you say - pick up the fact that they are importing right at the start, ask them where they want the converted file, put it there and open it. Simple and foolproof. Sometimes I can't see the wood for the trees! setFileURL:nil always worked

Re: UIImageView and UIViewContentModeBottomLeft

2010-08-05 Thread sebi
On 05.08.2010, at 02:41, David Duncan wrote: On Aug 4, 2010, at 4:46 PM, Jonathon Kuo wrote: On Aug 4, 2010, at 9:43 AM, David Duncan wrote: A UIView (really the CALayer owned by the view) can and will display content larger than its bounds if given to it. Is there a way to restrict

Re: [Q] Enter Key HIG

2010-08-05 Thread Martin Wierschin
The HIG states: - Enter Most applications add information to a document as soon as the user enters it. In some cases, however, the application may need to wait until a whole collection of information is available before processing it. The Enter key tells the application that the user

Re: [Q] Enter Key HIG

2010-08-05 Thread John Joyce
Please file a bug on the documentation. On Aug 5, 2010, at 1:29 AM, Martin Wierschin wrote: The HIG states: - Enter Most applications add information to a document as soon as the user enters it. In some cases, however, the application may need to wait until a whole collection of

Partially release NSMutableData

2010-08-05 Thread Marcus Karlsson
Hello. The subject of this thread is probably somewhat weird at first but let me explain. Let's say that I'm receiving data from the network and need to store it in a buffer. I need to store it until enough data has been collected, where what is considered enough is impossible to know

Problem with animator-proxy in 10.5 and NSApps -runModalForWindow

2010-08-05 Thread Markus Müller
Hi, I´ve a problem with the animator proxy under 10.5 Code: -(IBAction)doModal:(id)sender { NSRect windowFrame = [ window frame ]; windowFrame = NSInsetRect(windowFrame, -100.0, -100.0 ); [ [ window animator ] setFrame:windowFrame display:YES ]; // animation wouldn´t start in 10.5 if followed

Localizing standard alternate menu items in unsupported languages

2010-08-05 Thread Nick Kocharhook
Hello, My application is localized in several languages which OS X does not support. When the app is open in e.g. Czech, all the menu items appear as localized in the Czech MainMenu.xib. However, when you press the option key in the Window menu to get the alternate items (Minimize All, Zoom

CGImage, CIImage and NSImage

2010-08-05 Thread Mas Habibi
Hello, i'm a student who still learning how to program with Cocoa API, i have a little problem for what is the best way to displaying an image into NSView between CGImage, CIImage or NSImage, and what's the different? I have use the CGImage with this code, but there's an error when i

MKMapView

2010-08-05 Thread Gerriet M. Denkmann
I have an MKMapView which sometimes does: [ mapView addSubview: selectorView ]; and selectorView contains a UIPickerView. 1. When I interact with the pickerView, sometimes the mapView does seem to get events which are really meant for the pickerView and consequently displays annotation

Re: Partially release NSMutableData

2010-08-05 Thread Graham Cox
On 04/08/2010, at 11:02 PM, Marcus Karlsson wrote: 3. Use a single NSMutableData object. Once enough data has arrived move the data that may have been appended later to the beginning and adjust the capacity. Any opinions on which one to use or ideas on even better ones? This one's

Re: CGImage, CIImage and NSImage

2010-08-05 Thread Graham Cox
On 05/08/2010, at 3:26 AM, Mas Habibi wrote: I have use the CGImage with this code, but there's an error when i execute it, CGContextDrawImage(context, imageRect, drawnImage); Therefore the function must be broken, right? Wrong - you made a mistake. What's the error? which one is

Re: [Q] Enter Key HIG

2010-08-05 Thread Eric Gorr
I'm curious, what is the actual bug here? How should the documentation read with respect to the Enter key? Thank you. On Aug 5, 2010, at 2:32 AM, John Joyce wrote: Please file a bug on the documentation. On Aug 5, 2010, at 1:29 AM, Martin Wierschin wrote: The HIG states: -

Is this the correct way to cache an IMP?

2010-08-05 Thread Graham Cox
I have a Obj-C method that is highly recursive, and needs to run at maximum performance. With this in mind, I am locally caching the method's own IMP to avoid the message dispatch for the recursive calls. It seems to work and gives a measurable benefit, but I need to be absolutely certain it's

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Jean-Daniel Dupas
Le 5 août 2010 à 14:59, Graham Cox a écrit : I have a Obj-C method that is highly recursive, and needs to run at maximum performance. With this in mind, I am locally caching the method's own IMP to avoid the message dispatch for the recursive calls. It seems to work and gives a measurable

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Ken Thomases
On Aug 5, 2010, at 7:59 AM, Graham Cox wrote: I have a Obj-C method that is highly recursive, and needs to run at maximum performance. With this in mind, I am locally caching the method's own IMP to avoid the message dispatch for the recursive calls. It seems to work and gives a measurable

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Jean-Daniel Dupas
Le 5 août 2010 à 15:37, Graham Cox a écrit : On 05/08/2010, at 11:14 PM, Ken Thomases wrote: If you don't need to support subclassing and overriding of this method, just move its body to a function, and have the method be a thin wrapper around the function. The problem with that

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Ken Thomases
On Aug 5, 2010, at 8:47 AM, Jean-Daniel Dupas wrote: As I pointed in my previous post, just define the function inside your class body (between @implementation and @end), and you will be able to access private ivars using pointer syntax. Yes. A function within an @implementation is a part

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Graham Cox
On 05/08/2010, at 11:47 PM, Jean-Daniel Dupas wrote: As I pointed in my previous post, just define the function inside your class body (between @implementation and @end), and you will be able to access private ivars using pointer syntax. Ah, thanks, I see. Sorry, your email arrived after

Re: [Q] Enter Key HIG

2010-08-05 Thread Eric Gorr
Oh, bug filed, rdar://8276440 On Aug 5, 2010, at 8:08 AM, Eric Gorr wrote: I'm curious, what is the actual bug here? How should the documentation read with respect to the Enter key? Thank you. On Aug 5, 2010, at 2:32 AM, John Joyce wrote: Please file a bug on the documentation.

RE: NSWindow and setLevel

2010-08-05 Thread Aragao, Andre Augusto de (Andre)
Could anyone describe the behavior of setCollectionBehavior? It is not changing anything when I'm using a non-default window level (see below). Thanks in advance, Andre -Original Message- From: cocoa-dev-bounces+aragao=avaya@lists.apple.com

Re: Need help understanding first responder and multiple nibs

2010-08-05 Thread Jason Bruce
Thanks Quincey for all your help on this. Using a sheet for my filter window might be the way to go. Jason From: Quincey Morris quinceymor...@earthlink.net The filter window, since it's short-lived and specific to a single document, is probably better off as a sheet rather than a separate

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Graham Cox
On 05/08/2010, at 11:12 PM, Jean-Daniel Dupas wrote: Probably not faster, but cleaner IHMO: Thanks again - it definitely is cleaner, and I learned something about scoping functions, so a nice bonus! --Graham ___ Cocoa-dev mailing list

Re: CGImage, CIImage and NSImage

2010-08-05 Thread sebi
Hello, If you are still learning I would recommend NSImage, it's the easiest to use. If you need many images and high framerates I would recommend to use OpenGL. CGImage, CIImage are rarely used for special purposes.. I wouldn't bother with them at the beginning. Regards, Sebastian Mecklenburg

Resolution of an NSImage(Rep)?

2010-08-05 Thread Brian Postow
I have an NSImage. I want to save it with a CGImageDestination. the CGImageDestination wants a resolution. I know that the NSImage is resolution independent, but I happen to know that this image has only one NSImageRep. I also know that the image is bitmapdata. how do I get the resolution

calling a function in one class from another

2010-08-05 Thread Geoffrey Holden
If I have a class 'Foo' (containing the function 'Wabble'), which loads another class 'Bar', is it possible a function within 'Bar' to execute the 'Wabble' function within the calling class 'Foo'? Why do I want to do this? Well, 'Bar' contains all the code necessary to control a view. This

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Graham Cox
On 06/08/2010, at 12:39 AM, Brian Postow wrote: The width/pixelWidth ARE correct (1696, which is what you get when you scan 8.5 inches at 200DPI) but since they're the same, I just get the 72... Then the width isn't correct, which should be its size in points, not number of pixels. That

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Graham Cox
On 06/08/2010, at 12:39 AM, Brian Postow wrote: ([img size].width / [rep pixelWidth]) * 72 and that should be:- [rep pixelWidth] * 72.0 / [img size].width; Your formula is inverted, and you should multiply before dividing to get best precision.

Re: calling a function in one class from another

2010-08-05 Thread Graham Cox
On 06/08/2010, at 12:42 AM, Geoffrey Holden wrote: If I have a class 'Foo' (containing the function 'Wabble'), which loads another class 'Bar', is it possible a function within 'Bar' to execute the 'Wabble' function within the calling class 'Foo'? Yes, within Bar, you just have [theFoo

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Brian Postow
On Aug 5, 2010, at 10:48 AM, Graham Cox wrote: On 06/08/2010, at 12:39 AM, Brian Postow wrote: ([img size].width / [rep pixelWidth]) * 72 and that should be:- [rep pixelWidth] * 72.0 / [img size].width; Your formula is inverted, and you should multiply before dividing to get

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Graham Cox
On 06/08/2010, at 12:57 AM, Brian Postow wrote: But... um, then how do i fix my imgsize? this nsimage is sometimes coming from a PDFPage with: NSData* imgData = [pg dataRepresentation]; NSImage* img = [[NSImage alloc] initWithData:imgData ]; is there a better way to get the

AttributedString from NSData on iPhone.

2010-08-05 Thread Sandro Noël
Hello. I'm trying to take an attributed string from a PDF document and reproduce it on the phone. passing thru a SQLite Database. basically, i write to the database using NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:NSRTFDTextDocumentType

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Brian Postow
Ok, so a little research reveals that the problem is much earlier than I thought: the images I'm creating have no resolution data. So, the next question is: Given a bunch of bitmap data, and a resolution, how do I create an NSImage (or CGImage or CGImageSource) with the correct resolution?

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Ken Thomases
On 05/08/2010, at 11:12 PM, Jean-Daniel Dupas wrote: Probably not faster, but cleaner IHMO: Actually, I suspect it is faster. All function invocations are direct rather than indirected through a pointer. This is faster in and of itself and also allows the compiler to recognize the

Re: AttributedString from NSData on iPhone.

2010-08-05 Thread Kyle Sluder
On Thu, Aug 5, 2010 at 8:16 AM, Sandro Noël apple.li...@gestosoft.com wrote: NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:NSRTFDTextDocumentType forKey:NSDocumentTypeDocumentAttribute]; iOS has no RTF support. You'll need to use HTML (but I have no idea if

Re: AttributedString from NSData on iPhone.

2010-08-05 Thread Sandro Noël
Kyle. What does it have support for? On 2010-08-05, at 12:00 PM, Kyle Sluder wrote: On Thu, Aug 5, 2010 at 8:16 AM, Sandro Noël apple.li...@gestosoft.com wrote: NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:NSRTFDTextDocumentType

Re: UIImageView and UIViewContentModeBottomLeft

2010-08-05 Thread David Duncan
On Aug 4, 2010, at 11:14 PM, sebi wrote: Cool, thanks, that did it. What is the reason for clipsToBounds=YES is not being the default? I would think that's what most developers need. Typically it isn't necessary, since views are usually placed within the bounds of their parents and content

Re: AttributedString from NSData on iPhone.

2010-08-05 Thread David Duncan
On Aug 5, 2010, at 9:00 AM, Kyle Sluder wrote: On Thu, Aug 5, 2010 at 8:16 AM, Sandro Noël apple.li...@gestosoft.com wrote: NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:NSRTFDTextDocumentType forKey:NSDocumentTypeDocumentAttribute]; iOS has no RTF support. You'll

Re: AttributedString from NSData on iPhone.

2010-08-05 Thread Kyle Sluder
On Thu, Aug 5, 2010 at 9:10 AM, Sandro Noël apple.li...@gestosoft.com wrote: Kyle. What does it have support for? No idea, you'll have better luck getting an answer from someone who actively works on an iOS application. I just recall that the lack of RTF was an issue for our iPad apps that

Re: AttributedString from NSData on iPhone.

2010-08-05 Thread Kyle Sluder
On Thu, Aug 5, 2010 at 9:22 AM, David Duncan david.dun...@apple.com wrote: My recommendation to Sandro (assuming I understand his situation) would be to store a representation of the NSAttributedString (probably as strings with matching attribute dictionaries) and reassemble the

Re: MKMapView

2010-08-05 Thread Fritz Anderson
On 5 Aug 2010, at 2:57 AM, Gerriet M. Denkmann wrote: I have an MKMapView which sometimes does: [ mapView addSubview: selectorView ]; and selectorView contains a UIPickerView. I'm not sure why you feel it necessary to drop your selector view directly into the map view? My experience is

NSRunLoop's -runMode:beforeDate: not exiting after an NSTask finishes

2010-08-05 Thread Jens Alfke
I’ve got a place in my code where I need to block waiting for an otherwise-asynchronous action to complete, so I use a fairly standard technique of running a nested runloop. But sometimes the runloop just keeps waiting forever even after the action’s completed, so my app locks up. The wait

Re: AttributedString from NSData on iPhone.

2010-08-05 Thread Sandro Noël
David, you do understand properly as that was my question. how do i reassemble the NSAttributedString from a NSData where it was stored. On 2010-08-05, at 12:22 PM, David Duncan wrote: On Aug 5, 2010, at 9:00 AM, Kyle Sluder wrote: On Thu, Aug 5, 2010 at 8:16 AM, Sandro Noël

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Quincey Morris
On Aug 5, 2010, at 08:45, Brian Postow wrote: Given a bunch of bitmap data, and a resolution, how do I create an NSImage (or CGImage or CGImageSource) with the correct resolution? Currently, I'm doing: CGDataProviderRef provider= CGDataProviderCreateWithData(NULL, (UInt8*)data,

Re: AttributedString from NSData on iPhone.

2010-08-05 Thread David Duncan
On Aug 5, 2010, at 10:13 AM, Sandro Noël wrote: David, you do understand properly as that was my question. how do i reassemble the NSAttributedString from a NSData where it was stored. That is the code you have to write basically. NSAttributedString has the methods you need for both getting

Re: Partially release NSMutableData

2010-08-05 Thread A.M.
On Aug 4, 2010, at 9:02 AM, Marcus Karlsson wrote: Hello. The subject of this thread is probably somewhat weird at first but let me explain. Let's say that I'm receiving data from the network and need to store it in a buffer. I need to store it until enough data has been collected,

Re: AttributedString from NSData on iPhone.

2010-08-05 Thread Sandro Noël
Thank you david, I think i'll try serializing it and de-serializing it that should do the trick. Best regards. Sandro. On 2010-08-05, at 1:18 PM, David Duncan wrote: On Aug 5, 2010, at 10:13 AM, Sandro Noël wrote: David, you do understand properly as that was my question. how do i

iOS4: remote / headset events and the remote control display

2010-08-05 Thread John Michael Zorko
Hello, all ... My iOS4 application plays audio, runs in the background and receives remote control events. All of this works, but the one thing that sometimes doesn't is the updating of the pause / play state on the remote control display. In other words, i'll tell my app to play, put it in

Re: NSRunLoop's -runMode:beforeDate: not exiting after an NSTask finishes

2010-08-05 Thread Kyle Sluder
On Thu, Aug 5, 2010 at 10:10 AM, Jens Alfke j...@mooseyard.com wrote: What I’m guessing is that running a delayed block does not count as an “input source”. That’s kind of frustrating, because it makes the runloop’s behavior highly dependent on internal details of framework classes — in this

Re: NSRunLoop's -runMode:beforeDate: not exiting after an NSTask finishes

2010-08-05 Thread Jeff Johnson
Hi Jens. Why do you just set a short timeout rather than distantFuture? That's why I usually do. -Jeff On Aug 5, 2010, at 12:10 PM, Jens Alfke wrote: I’ve got a place in my code where I need to block waiting for an otherwise-asynchronous action to complete, so I use a fairly standard

Re: NSRunLoop's -runMode:beforeDate: not exiting after an NSTask finishes

2010-08-05 Thread Jean-Daniel Dupas
Le 5 août 2010 à 19:10, Jens Alfke a écrit : I’ve got a place in my code where I need to block waiting for an otherwise-asynchronous action to complete, so I use a fairly standard technique of running a nested runloop. But sometimes the runloop just keeps waiting forever even after the

Re: calling a function in one class from another

2010-08-05 Thread Quincey Morris
On Aug 5, 2010, at 07:42, Geoffrey Holden wrote: If I have a class 'Foo' (containing the function 'Wabble'), which loads another class 'Bar', is it possible a function within 'Bar' to execute the 'Wabble' function within the calling class 'Foo'? You repeatedly say function, but do you mean

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Brian Postow
On Aug 5, 2010, at 1:15 PM, Quincey Morris wrote: On Aug 5, 2010, at 08:45, Brian Postow wrote: Given a bunch of bitmap data, and a resolution, how do I create an NSImage (or CGImage or CGImageSource) with the correct resolution? Currently, I'm doing: CGDataProviderRef provider=

Question about color

2010-08-05 Thread Eric E. Dolecki
This is a noob question, and as I pour through the docs, I thought I would ask here too. I have buttons that have different text colors. All I would like to do is to check the color after it's been clicked. -(void) aButtonWasClicked:(id)sender { UIButton* resultButton = (UIButton*)sender;

Re: Question about color

2010-08-05 Thread Dave DeLong
You shouldn't be relying on the color of a button to determine what to do next. The color of the button should reflect some state that's maintained internally by the controller, and you should rely on that state to determine what to do next. Dave smime.p7s Description: S/MIME cryptographic

Re: Question about color

2010-08-05 Thread Nick Zitzmann
On Aug 5, 2010, at 11:45 AM, Eric E. Dolecki wrote: How can I check what the color is in order to manipulate the button after it's pressed? If it's gray, do one thing, if it's another color, do something else. I'm not sure how to run an if on it yet. On iOS you'd have to use the functions

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Quincey Morris
On Aug 5, 2010, at 10:43, Brian Postow wrote: oh, so size is in points? I assumed it was in pixels. The documentation just says the size of the receiver which my boss assumed was in pounds B-) Yes, but when consulting the documentation looking for answers like this, check both the setter and

Re: NSRunLoop's -runMode:beforeDate: not exiting after an NSTask finishes

2010-08-05 Thread Ken Thomases
On Aug 5, 2010, at 12:10 PM, Jens Alfke wrote: The wait code looks like: while (_busy) { if (![[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate: [NSDate distantFuture]]) break; } Since you're waiting on an NSTask to finish, is there a reason

Re: Question about color

2010-08-05 Thread Eric E. Dolecki
Not that I am going forward with this, but this seems to determine if the color is b/w/gray or color: -(void) buttonClicked:(id)sender { UIButton *resultButton = (UIButton *)sender; UIColor *color = [resultButton titleColorForState:UIControlStateNormal]; CGColorRef color2 = [color

Re: Question about color

2010-08-05 Thread Nick Zitzmann
On Aug 5, 2010, at 12:13 PM, Eric E. Dolecki wrote: Not that I am going forward with this, but this seems to determine if the color is b/w/gray or color: -(void) buttonClicked:(id)sender { UIButton *resultButton = (UIButton *)sender; UIColor *color = [resultButton

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Brian Postow
On Aug 5, 2010, at 2:03 PM, Quincey Morris wrote: I can't think of any jokes in response to the size of the receiver in pounds that don't violate forum politeness guidelines, so I'll cede you the win on that one. hehe Ok, now the question is how do I put the image into a PDFDocument?

Re: calling a function in one class from another

2010-08-05 Thread Joanna Carter
Hi Geoffrey If I have a class 'Foo' (containing the function 'Wabble'), which loads another class 'Bar', is it possible a function within 'Bar' to execute the 'Wabble' function within the calling class 'Foo'? Your first problem is that you are talking about classes without thinking about

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Brian Postow
On Aug 5, 2010, at 3:07 PM, Quincey Morris wrote: On Aug 5, 2010, at 11:23, Brian Postow wrote: the representations size is also in points. Well, to clarify, do you really mean size? I would assume that imageRep.size.width == image.size.width (both are in points), but

Re: Resolution of an NSImage(Rep)?

2010-08-05 Thread Quincey Morris
On Aug 5, 2010, at 12:18, Brian Postow wrote: I have the following code: PDFPage* pdfPage = [[PDFPage alloc] initWithImage: img]; DEBUGSTR(@I have %d pages, [doc pageCount]); [doc insertPage:pdfPage atIndex: maxPage ]; NSData* imgData = [pdfPage dataRepresentation];

Coercion exception assigning a Core Data property

2010-08-05 Thread Rick Mann
My co-worker is experiencing an odd problem in our Core Data app (iOS 3.2). We have code that assigns one object to a property of another: Foo* foo = instance of DerivedFoo; Baz* baz = instance of DerivedBaz; foo.myBaz = baz; In this case, foo and baz are both Core Data entities with explicit

[SOLVED] Coercion exception assigning a Core Data property

2010-08-05 Thread Rick Mann
Ah! He was relating objects in different contexts. I feel like CD could've given us a more informative error code here. On Aug 5, 2010, at 14:24:05, Rick Mann wrote: My co-worker is experiencing an odd problem in our Core Data app (iOS 3.2). We have code that assigns one object to a property

Re: [SOLVED] Coercion exception assigning a Core Data property

2010-08-05 Thread Mark Ritchie
Hey! On 5/Aug/2010, at 4:00 PM, Rick Mann wrote: Ah! He was relating objects in different contexts. I feel like CD could've given us a more informative error code here. You should make a short example and file a bug report! ;-) That way, you and everyone else will benefit in the future! M.

Re: NSRunLoop's -runMode:beforeDate: not exiting after an NSTask finishes

2010-08-05 Thread Jens Alfke
On Aug 5, 2010, at 10:27 AM, Jeff Johnson wrote: Why do you just set a short timeout rather than distantFuture? That's why I usually do. Because polling is bad. More specifically, if you choose a short timeout, this loop consumes CPU time and keeps bits of your code hot in the VM cache. But

UIActionSheet - Insert button at index?

2010-08-05 Thread Joshua Tucker
Hey, is there a way I can insert a button into a UIActionSheet with specific index? Thanks in advance, Josh ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the

Re: MKMapView

2010-08-05 Thread Gerriet M. Denkmann
On 6 Aug 2010, at 00:03, Fritz Anderson wrote: On 5 Aug 2010, at 2:57 AM, Gerriet M. Denkmann wrote: I have an MKMapView which sometimes does: [ mapView addSubview: selectorView ]; and selectorView contains a UIPickerView. I'm not sure why you feel it necessary to drop your