From: Knud H. M. <knu...@de...> - 2008-04-14 12:17:34
|
Am 14.04.2008 um 12:58 schrieb Axel M. Roest: > At 12:51 +0100 14-04-2008, Knud Hinnerk Möller wrote: >> > @implementation KNTileView >>> ... >>> NSSize originalSize = [dataSource dimensions]; >>> ... >>> @end >> > >> > This leads to a compile "error: invalid initializer". > > > How do you initialize the dataSource object? > You can e.g. do 'dataSource=KNTiledMap.new' or use Interface Builder > to instantiate the object from the class. Thanks for the help. Ok, there are three players here. KNTileMap, which is a RubyCocoa class, AppController, also a RubyCocoa class, and KNTileView, an Obj-C class. The view and controller get instantiated through IB. In the controller, there is this code: @map = KNTiledMap.alloc.initWithPath(@pathTextBox.stringValue) @tileView.setDataSource(@map) That works. In the view, I have now made the call to [dataSource dimensions] compile by adding a protocol definition to the view class (as shown here: http://www.rubycocoa.com/an-introduction-to-rubycocoa/ 4) - this seems very awkward. Also, the method call returns a nonsense value. Is there a problem with passing C structs through Ruby? Cheers, Knud ------------------------------------------------- Knud Möller, MA +353 - 91 - 495086 Smile Group: http://smile.deri.ie Digital Enterprise Research Institute National University of Ireland, Galway Institiúid Taighde na Fiontraíochta Digití Ollscoil na hÉireann, Gaillimh |