NSOperationQueue and for-loop

2012-10-02 Thread Koen van der Drift
Hi, When looking how to implement an NSOperationQueue with a loop, I found several examples that have the following structure: NSInteger i; for ( i = 0; i < 1000; i++ ) { [queue addOperationWithBlock:^{ i += 1; }];

Re: NSOperationQueue and for-loop

2012-10-02 Thread davelist
On Oct 2, 2012, at 5:49 PM, Koen van der Drift wrote: > Hi, > > When looking how to implement an NSOperationQueue with a loop, I found > several examples that have the following structure: > > NSInteger i; > >for ( i = 0; i < 1000; i++ ) { >[queue addOpera

Re: NSOperationQueue and for-loop

2012-10-02 Thread Koen van der Drift
On Oct 2, 2012, at 6:07 PM, davel...@mac.com wrote: > I can't speak to the other examples since I haven't seen them, but the > __block specifier is necessary if your block modifies the variable (your > block does modify i). Your example also seems a bit strange since your for > loop modifies i

Safety of re-entering -[NSWindow makeFirstResponder:]?

2012-10-02 Thread Kyle Sluder
Hey all, Is it safe to re-enter -[NSWindow makeFirstResponder:]? Specifically, I am thinking of overriding -becomeFirstResponder to call [window makeFirstResponder:someOtherView]. The answer to this question seems intuitively yes, since that's how one would expect a view makes use of the field ed

Re: NSOperationQueue and for-loop

2012-10-02 Thread Koen van der Drift
On Oct 2, 2012, at 6:19 PM, Koen van der Drift wrote: > > On Oct 2, 2012, at 6:07 PM, davel...@mac.com wrote: > >> I can't speak to the other examples since I haven't seen them, but the >> __block specifier is necessary if your block modifies the variable (your >> block does modify i). Your

Re: NSOperationQueue and for-loop

2012-10-02 Thread davelist
On Oct 2, 2012, at 8:43 PM, Koen van der Drift wrote: > > On Oct 2, 2012, at 6:19 PM, Koen van der Drift > wrote: > >> >> On Oct 2, 2012, at 6:07 PM, davel...@mac.com wrote: >> >>> I can't speak to the other examples since I haven't seen them, but the >>> __block specifier is necessary i

Re: NSOperationQueue and for-loop

2012-10-02 Thread Koen van der Drift
On Oct 2, 2012, at 9:21 PM, davel...@mac.com wrote: > Only variables that are being modified by the block need to be declared with > the __block specifier. You shouldn't be declaring the underlying instance > variables as __block. You can mix and match ARC and non-ARC code. Google > should hel