iPhone SDK 3.0

by Manu (modified: 2009 Jun 18)

Last night I've upgraded my iPod Touch to the latest iPhone OS 3.0 and its corresponding SDK. The OS upgrade went smoothly. However for the SDK, what I had done was not working when I switch the include path to use the 3.0 SDK because it also required GCC 4.2 (by default it is GCC 4.0). Once I changed that, the Eiffel code compiled just fine.

Since my last blog entry, the iPhone library available under $EIFFEL_SRC/experimental/library/iphone (and its corresponding example in $EIFFEL_SRC/examples/iphone/basic) is able to respond to the touch events. You can detect the start, the moving and the end of a touch.

Here is the extract of the application:

indexing description : "basic application root class" date : "$Date: 2009-06-15 23:25:41 (Mon, 15 Jun 2009) $" revision : "$Revision: 79297 $" class APPLICATION inherit ARGUMENTS SHARED_LOG EXCEPTION_MANAGER create make feature {NONE} -- Initialization make -- Run application. local l_app: UI_APPLICATION do create l_app l_app.post_launch_actions.extend (agent launch) l_app.launch rescue if attached last_exception as l_exception then put_string (l_exception.exception_trace) end end feature -- Actions launch local window: UI_WINDOW l_label: UI_LABEL l_rect: CG_RECT do l_rect := (create {UI_SCREEN}.make).bounds create window.make (l_rect) create l_rect.make (10, 50, 300, 100) create l_label.make_with_text ("Hello World!", l_rect) l_label.set_background_color ( create {UI_COLOR}.make_rgba (0, 1, 0, 1)) l_label.set_foreground_color ( create {UI_COLOR}.make_rgba (1, 0, 1, 1)) l_label.align_text_center window.extend (l_label) window.touches_began_actions.extend ( agent touch_began_action (l_label, ?)) window.touches_moved_actions.extend ( agent touch_moved_action (l_label, ?)) window.touches_ended_actions.extend ( agent touch_ended_action (l_label, ?)) window.show end touch_began_action (a_label: UI_LABEL; a_event: UI_EVENT) local l_point: CG_POINT do if attached {UI_TOUCH} a_event.all_touches.item as l_touch then l_point := l_touch.location a_label.set_text ("Starting touch " + i.out + " ...") a_label.set_center (l_point) i := i + 1 end end touch_moved_action (a_label: UI_LABEL; a_event: UI_EVENT) local l_point: CG_POINT do if attached {UI_TOUCH} a_event.all_touches.item as l_touch then l_point := l_touch.location a_label.set_text ("Moving touch " + i.out + " ...") a_label.set_center (l_point) i := i + 1 end end touch_ended_action (a_label: UI_LABEL; a_event: UI_EVENT) local l_point: CG_POINT do if attached {UI_TOUCH} a_event.all_touches.item as l_touch then l_point := l_touch.location a_label.set_text ("Ending touch " + i.out + " ...") a_label.set_center (l_point) i := i + 1 end end i: NATURAL_64

I'm looking for people who would like to help in improving the Eiffel iPhone library by wrapping the iPhone UI classes. If you are interested contact me so that we can get together to organize an effective plan of work.

Comments
  • Daniel Furrer (14 years ago 23/6/2009)

    3.0 SDK

    Hey Manu,

    If you could write down the steps to get everything running I would be glad to play around with your library a little. I have OS 3.0 running and I am in the iPhone developer program already.

    Daniel

    • Manu (14 years ago 23/6/2009)

      I'm building that page at the moment. It is located on http://dev.eiffel.com/iPhone_Development but there is not much there yet. I'll try to complete it tonight.