objective-c/iPhone - does it support ioc? (inversion of control)

63 views
Skip to first unread message

VGurbuxani

unread,
Jun 30, 2008, 10:07:02 AM6/30/08
to iPhoneOSCoders
Hi iPhone developers-

I have begun programming in objective-c primarily for iphone sdk
development. I have been very impressed with the language thus far,
(my previous background being java and using the spring framework).

I was wondering if there was a way I could do the following:
1. I would like to create a event/method interceptor class, which
intercepts or listens to a class that I have instantiated.

For example, the iPhone stack as I understand it, on a very high-
level.
1. A user touches the iphone screen
-the user presses the home button
2. the users' actions are captured
-the coordinates of the users' touch are converted into what element
the user has touched
3. the users actions are interpreted and the correct method is called
within the instantiated class.
-the instantiated class is called with an action being fired from the
users' touch

For example, say I wanted to log all the methods that were being
called from my iPhone application. Is there a way I can do that,
without implicitly coding a logging line in every method that I want
to capture?

I would be extremely helpful/greatful for your help!

thanks

Vishal

Michael Rutman

unread,
Jun 30, 2008, 9:32:30 PM6/30/08
to iphoneo...@googlegroups.com

You'd have to try it, but I believe you can just replace the method
dispatcher with one of your own, log everything, then call through to
the original method dispatcher.

Easier, by far, is to just use Instruments, which has that ability
built into it.

Reply all
Reply to author
Forward
0 new messages