Re: "Ownership follows the 'Create' Rule'" - not literally

2013-08-23 Thread Quincey Morris
On Aug 23, 2013, at 21:13 , Jerry Krinock wrote: > Lesson: When documentation says that "Ownership follows the 'Create Rule'" > for a parameter, what they really mean to say is that "When applying the > 'Create Rule' to this function, proceed as though this function had 'Create' > in its name"

Re: Audio in WebView stop when close NSWindow

2013-08-23 Thread li shunlian
在 2013-8-24,上午3:34,Nick Zitzmann 写道: > > On Aug 23, 2013, at 11:01 AM, li shunlian wrote: > >> I create a WebView to open a web page and this web page can play audio. When >> I close the NSWindow the audio stop. I open the window again, but the audio >> can not play again and I have to relo

"Ownership follows the 'Create' Rule'" - not literally

2013-08-23 Thread Jerry Krinock
OS X app, manual retain/release. According to 'leaks' with MallocStackLoggingNoCompact, I was leaking a CFData object when I called CFMessagePortSendRequest(). Indeed, the last parameter of CFMessagePortSendRequest() returns a CFData object by reference, and the documentation states that "Owner

Re: NSWindow setMinSize: jumps up to current size instead

2013-08-23 Thread Jerry Krinock
On 2013 Aug 23, at 13:41, Ken Thomases wrote: > On Aug 23, 2013, at 3:22 PM, Jerry Krinock wrote: > >> On 2013 Aug 23, at 12:53, Ken Thomases wrote: >> >>> I think it's just that, if you use -setContentMinSize:, you shouldn't also >>> use -setMinSize:. >> >> Yes, I'd thought of that, and ch

Re: NSWindow setMinSize: jumps up to current size instead

2013-08-23 Thread Ken Thomases
On Aug 23, 2013, at 3:22 PM, Jerry Krinock wrote: > On 2013 Aug 23, at 12:53, Ken Thomases wrote: > >> I think it's just that, if you use -setContentMinSize:, you shouldn't also >> use -setMinSize:. > > Yes, I'd thought of that, and checked for it with the Find Navigator, but the > answer is

Re: NSWindow setMinSize: jumps up to current size instead

2013-08-23 Thread Jerry Krinock
On 2013 Aug 23, at 12:53, Ken Thomases wrote: > I think it's just that, if you use -setContentMinSize:, you shouldn't also > use -setMinSize:. Yes, I'd thought of that, and checked for it with the Find Navigator, but the answer is that I was *not* using setContentMinSize: anywhere on this win

Re: How to observe validity of NSTextField+NSNumberFormatter?

2013-08-23 Thread Keary Suska
On Aug 23, 2013, at 10:57 AM, Rob Nikander wrote: > I want to constrain an NSTextField to float values greater than zero, so I > connected an NSNumberFormatter in Interface Builder. Now the user can enter > invalid text (eg, "1a", "-2") but it beeps when you try to leave the field. > That may be o

Fwd: Protocols and the +initialize class method

2013-08-23 Thread Maxthon Chan
Begin forwarded message: > From: Maxthon Chan > Subject: Re: Protocols and the +initialize class method > Date: August 23, 2013 at 23:30:19 GMT+8 > To: Fritz Anderson > > Well you can category on NSObject to perform the checking. > > Sent from my iPhone > >> On 2013年8月23日, at 21:28, Fritz A

Re: Using CGContext as a graphics state object

2013-08-23 Thread Graham Cox
Answering my own question, it looks as if the answer is no. While CGContext has lots of Setxxx methods, it has no Getxxx methods, so getting the current internal state isn't possible. Oh well, roll my own it is…. --Graham On 23/08/2013, at 9:46 PM, Graham Cox wrote: > My question is, would

Re: Audio in WebView stop when close NSWindow

2013-08-23 Thread Ken Thomases
On Aug 23, 2013, at 2:34 PM, Nick Zitzmann wrote: > On Aug 23, 2013, at 11:01 AM, li shunlian wrote: > >> I create a WebView to open a web page and this web page can play audio. When >> I close the NSWindow the audio stop. I open the window again, but the audio >> can not play again and I have

Re: NSWindow setMinSize: jumps up to current size instead

2013-08-23 Thread Ken Thomases
On Aug 23, 2013, at 10:22 AM, Jerry Krinock wrote: > On 2013 Aug 23, at 07:03, Keary Suska wrote: > >> Anyway, perhaps it is a bug in reconciling minSize with minContentSize. > > I know, but I really don't want to go there. This is NSWindow, for heaven's > sake. From NeXT. The method setMin

Using CGContext as a graphics state object

2013-08-23 Thread Graham Cox
I need to parse PDF data to extract the graphics objects within. I'm using the CGPDFScanner and associated API and it's so far working pretty well. One of the things that is needed is to maintain a graphics state, etc as the PDF is parsed. I have two choices - roll my own or use a CGContext, whi

Re: Audio in WebView stop when close NSWindow

2013-08-23 Thread Nick Zitzmann
On Aug 23, 2013, at 11:01 AM, li shunlian wrote: > I create a WebView to open a web page and this web page can play audio. When > I close the NSWindow the audio stop. I open the window again, but the audio > can not play again and I have to reload this web page again. Can anyone give > me so

Re: Protocols and the +initialize class method

2013-08-23 Thread Glenn L. Austin
On Aug 23, 2013, at 10:30 AM, David Duncan wrote: > On Aug 23, 2013, at 2:49 AM, Kevin Meaney wrote: > >> I have a protocol where I would like to include the class method >> +(void)initialize as being required. This way all classes that conform to >> the protocol have to implement initializ

Re: Protocols and the +initialize class method

2013-08-23 Thread Jens Alfke
On Aug 23, 2013, at 10:30 AM, David Duncan wrote: > On Aug 23, 2013, at 2:49 AM, Kevin Meaney wrote: > >> I have a protocol where I would like to include the class method >> +(void)initialize as being required. This way all classes that conform to >> the protocol have to implement initializ

Re: How to observe validity of NSTextField+NSNumberFormatter?

2013-08-23 Thread Rob Nikander
Aha, I just read about the window's FieldEditor in the Cocoa Text Architecture Guide. That answers most of my question. I'm still wondering why calling textField.doubleValue during the notification changes the value of the field. But with the field editor I can check the validity as I wanted to. R

Re: Protocols and the +initialize class method

2013-08-23 Thread David Duncan
On Aug 23, 2013, at 2:49 AM, Kevin Meaney wrote: > I have a protocol where I would like to include the class method > +(void)initialize as being required. This way all classes that conform to the > protocol have to implement initialize as part of the protocol. I suppose I'm > wondering if any

Re: Audio in WebView stop when close NSWindow

2013-08-23 Thread Alex Zavatone
I noticed something on iOS the other day that may help you with this issue. My app has a tab bar controller with two tabs. In one tab's scene, I load a video in a UIWebView and it starts playing and you can hear the audio. Click on the other tab to show other content and the audio keeps playin

Audio in WebView stop when close NSWindow

2013-08-23 Thread li shunlian
Dear list, I create a WebView to open a web page and this web page can play audio. When I close the NSWindow the audio stop. I open the window again, but the audio can not play again and I have to reload this web page again. Can anyone give me some advices to make the audio not stop? Thanks!

How to observe validity of NSTextField+NSNumberFormatter?

2013-08-23 Thread Rob Nikander
Hi, I want to constrain an NSTextField to float values greater than zero, so I connected an NSNumberFormatter in Interface Builder. Now the user can enter invalid text (eg, "1a", "-2") but it beeps when you try to leave the field. That may be okay. Now I'd like to disable other parts of the UI wh

Re: Fastest way to replace characters in string

2013-08-23 Thread Thomas Wetmore
On Aug 23, 2013, at 9:40 AM, Alex Zavatone wrote: > > Why isn't it a good idea to have everything set up before you need it? > > In my reasoning, If there is downtime when items can be set up of prefetched > before they are needed, then they are ready for use when needed. > > If you don't d

Re: Static analyser grumbling

2013-08-23 Thread Kyle Sluder
On Aug 23, 2013, at 4:27 AM, Kevin Meaney wrote: > > But my feeling is that the analyzer is talking about context. Normally I'd > consider that an object passed into an init method will consume a retain > count. Nope. The only consumed refcount is that of the receiver. How is the analyzer su

Re: NSWindow setMinSize: jumps up to current size instead

2013-08-23 Thread Jerry Krinock
On 2013 Aug 23, at 07:03, Keary Suska wrote: > Just to be sure, is autolayout enabled? No. > Anyway, perhaps it is a bug in reconciling minSize with minContentSize. I know, but I really don't want to go there. This is NSWindow, for heaven's sake. From NeXT. The method setMinSize: has prob

Re: NSWindow setMinSize: jumps up to current size instead

2013-08-23 Thread Keary Suska
On Aug 23, 2013, at 7:24 AM, Jerry Krinock wrote: > This should be easy. What am I doing wrong here? > > • Window height is 692, content min height is 363 and min height is 431. > • I set the min height to 646. > • Read it back, using -minSize. > > Expected result: Because I tried to *increase

Re: Fastest way to replace characters in string

2013-08-23 Thread Alex Zavatone
On Aug 22, 2013, at 2:05 PM, Thomas Wetmore wrote: > Steve, > > Sorry, again I was unclear. Here is what I am trying to say: > > Pre-allocation means to allocate space before you need it, which would be at > init time. > > But there is no need to pre-allocate -- the first allocation can be po

Re: Protocols and the +initialize class method

2013-08-23 Thread Fritz Anderson
On 23 Aug 2013, at 4:49 AM, Kevin Meaney wrote: > I have a protocol where I would like to include the class method > +(void)initialize as being required. This way all classes that conform to the > protocol have to implement initialize as part of the protocol. I suppose I'm > wondering if anyo

NSWindow setMinSize: jumps up to current size instead

2013-08-23 Thread Jerry Krinock
This should be easy. What am I doing wrong here? • Window height is 692, content min height is 363 and min height is 431. • I set the min height to 646. • Read it back, using -minSize. Expected result: Because I tried to *increase* the *minimum* height, and to a value less than the current hei

Re: Static analyser grumbling

2013-08-23 Thread Robert Martin
If the context is created, and the init succeeds and returns a valid self, then you are leaking the context. Get rid of the 'else', since it causes the code to skip over the release. On Aug 23, 2013, at 7:27 AM, Kevin Meaney wrote: > Hi, > > I'm using ARC and using Mavdacted and DP5 but I do

Static analyser grumbling

2013-08-23 Thread Kevin Meaney
Hi, I'm using ARC and using Mavdacted and DP5 but I don't think this is related to anything under NDA. The static analyzer is complaining about the following: -(instancetype)initWithPreset:(NSString *)preset size:(CGPoint)size { CGContextRef context = CreateCGBitmapContextFromPresetSize(

Protocols and the +initialize class method

2013-08-23 Thread Kevin Meaney
Hi all, I have a protocol where I would like to include the class method +(void)initialize as being required. This way all classes that conform to the protocol have to implement initialize as part of the protocol. I suppose I'm wondering if anyone perceives any problem with doing this? For ex