Started working on imGravityGame, a demonstration of the use of IMSRGravity in the imSimReal framework. I’m working on the flipSide where I start with a Picker to pick the body providing the gravitational attraction, such as a planet. In -initWithNibName:Bundle:, I load the IMSRGravity object.
gravity = [IMSRGravity alloc] init];
In -viewDidLoad:, I construct an NSArray using the keys from gravity:
planets = [gravity allKeys];
The FlipSide implements two data source methods:
-numberOfComponentsInPickerView:
which returns 1, and
-pickerView:numberOfRowsInComponent:
which returns the number of planets in the gravity:
return [planets count];
It also implements one UIPickerViewDelegateMethod
:
-pickerView:titleForRow:forComponent:
which returns the name of the planet indicated by the NSInteger row
return [planets objectAtIndex: row];
At this point I realized that IMSRGravity needs a place to store the currently selected planet, so I will be going back to imSimReal and preparing 0.1RC3 soon (like tomorrow, hopefully).
Here is the current status of FlipSideViewController class:
@interface FlipsideViewController : UIViewController
{
IBOutlet UIPickerView *planetView;
IMSRGravity *gravity;
NSArray *planets;
}
@property (nonatomic, retain) UIPickerView *planetView;
@property (nonatomic, retain) IMSRGravity *gravity;
@property (nonatomic, retain) NSArray *planets;
@end
Technorati Tags:
imSimReal, iPhone, imGravityGame
Twitter Tweets about iPhone as of January 17, 2009 | Bay Area REO // Jan 18, 2009 at 4:10 am
[...] · View john146: Latest on imGravityGame, a demo project for the iPhone and imSimReal. http://imsimreal.com/blog/?p=9 2009-01-18 04:06:55 · Reply · View JimGiseburt: is syncing music to my new iPhone [...]