Re: Forcing subclass creation through method swizzling not airtight?

2012-03-12 Thread Greg Parker
On Mar 10, 2012, at 11:05 PM, Antonio Nunes wrote: > In the latest public release of my software, I used method swizzling to force > creation of my subclass when the system tries to create instances of its > superclass. However, I have received a very few reports where apparently > instances of

Re: Calling objc_getAssociatedObject in -finalize.

2012-03-12 Thread Greg Parker
On Mar 10, 2012, at 3:19 AM, jonat...@mugginsoft.com wrote: > Consider a GC app. > It is not safe to access object ivars during -finalize due to the uncertainty > which self and the ivar objects will be finalised. > > Question: > Is it safe to call objc_getAssociatedObject in -finalize or do th

Re: Method Replacement (was "swizzling") not airtight?

2012-03-12 Thread Jerry Krinock
I changed the title of this thread after realizing that what Antonio is doing was called "Method Replacement" in Apple Sample Code On 2012 Mar 12, at 09:57, Greg Parker wrote: > If you want to be absolutely sure your swizzling is performed early on during > application startup, use a +load met

Re: Forcing subclass creation through method swizzling not airtight?

2012-03-12 Thread Antonio Nunes
On 12 Mar 2012, at 16:57, Greg Parker wrote: > On Mar 10, 2012, at 11:05 PM, Antonio Nunes wrote: >> In the latest public release of my software, I used method swizzling to >> force creation of my subclass when the system tries to create instances of >> its superclass. However, I have received a

iOS: preventing popping nav controller

2012-03-12 Thread Rick Mann
So, googling suggests I can't do this. I'm rather surprised. In my case, I want to have the user verify they're about to resign the game they're playing if they go back. I can't set the nav bar delegate, which is what I need to do. I can subclass UINavigationController to ask my top view if it

Re: iOS: preventing popping nav controller

2012-03-12 Thread Roland King
When the game starts, replace the back button on the navigation item with your own 'quit' button, or remove it totally and put a quit button on the right-hand-side of the navigation bar instead. This can be quite a nice way to show you are no longer just 'navigating' but you are now in a differe

Re: iOS: preventing popping nav controller

2012-03-12 Thread Rick Mann
Yeah, I thought of this approach, but it smells funny to me. It doesn't seem much different from putting the game in a modal sheet, which also strikes me as wrong. But maybe that's the right thing to do. -- Rick On Mar 12, 2012, at 18:41 , Roland King wrote: > When the game starts, replace t

Re: iOS: preventing popping nav controller

2012-03-12 Thread Roland King
I think it's a pretty common pattern, quite a few of the apps I have on my phone do something like this, less to force modality, more to make better use of the limited space for icons on the navigation bar and be contextual. Pages, Numbers etc do it to some extent. I just tested iPhoto and that

Re: iOS: preventing popping nav controller

2012-03-12 Thread Rick Mann
On Mar 12, 2012, at 18:57 , Roland King wrote: > If you really hate that, not sure what you can do. What was your idea for > subclassing UINavigationController? I didn't instantly see a place to hook in > without messing with the navigationBar delegate, something the documentation > tells you