New a better way of initializing classes and objects
<p>Here is a code that I thought of to initialize my picker with. Is there a better way to write this?</p>

<h2>The interface</h2>

<pre><code>@interface roomsClass : NSObject {
    NSInteger roomID;
    NSString *name;
    NSString *desc;
}

@property (nonatomic, readwrite) NSInteger roomID;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *desc;

@end

@interface typesClass : NSObject {
    NSInteger typeID;
    NSString *name;
}

@property (nonatomic, readwrite) NSInteger typeID;
@property (nonatomic, copy) NSString *name;

@end
</code></pre>

<h2>The implementation</h2>

<pre><code>NSMutableArray *tempArrayA = [[NSMutableArray alloc] init];
self.roomsArray = tempArrayA;
[tempArrayA release];

roomsClass *tempObjA1 = [[roomsClass alloc] init];
tempObjA1.roomID = 202; 
tempObjA1.name = @"MH202";
tempObjA1.desc = @"Lab";
[roomsArray addObject:tempObjA1];
[tempObjA1 release];

roomsClass *tempObjA2 = [[roomsClass alloc] init];
tempObjA2.roomID = 207; 
tempObjA2.name = @"MH207";
tempObjA2.desc = @"Office";
[roomsArray addObject:tempObjA2];
[tempObjA2 release];

roomsClass *tempObjA3 = [[roomsClass alloc] init];
tempObjA3.roomID = 208; 
tempObjA3.name = @"MH208";
tempObjA3.desc = @"Office";
[roomsArray addObject:tempObjA3];
[tempObjA3 release];

roomsClass *tempObjA4 = [[roomsClass alloc] init];
tempObjA4.roomID = 209; 
tempObjA4.name = @"MH209";
tempObjA4.desc = @"Lab";
[roomsArray addObject:tempObjA4];
[tempObjA4 release];

roomsClass *tempObjA5 = [[roomsClass alloc] init];
tempObjA5.roomID = 210; 
tempObjA5.name = @"MH210";
tempObjA5.desc = @"Lab";
[roomsArray addObject:tempObjA5];
[tempObjA5 release];

roomsClass *tempObjA6 = [[roomsClass alloc] init];
tempObjA6.roomID = 211; 
tempObjA6.name = @"MH211";
tempObjA6.desc = @"Office";
[roomsArray addObject:tempObjA6];
[tempObjA6 release];

NSMutableArray *tempArrayB = [[NSMutableArray alloc] init];
self.typesArray = tempArrayB;
[tempArrayB release];

typesClass *tempObjB1 = [[typesClass alloc] init];
tempObjB1.typeID = 1; 
tempObjB1.name = @"Desktop";
[typesArray addObject:tempObjB1];
[tempObjB1 release];

typesClass *tempObjB2 = [[typesClass alloc] init];
tempObjB2.typeID = 2; 
tempObjB2.name = @"Laptop";
[typesArray addObject:tempObjB2];
[tempObjB2 release];

typesClass *tempObjB3 = [[typesClass alloc] init];
tempObjB3.typeID = 3; 
tempObjB3.name = @"Monitor";
[typesArray addObject:tempObjB3];
[tempObjB3 release];

typesClass *tempObjB4 = [[typesClass alloc] init];
tempObjB4.typeID = 4; 
tempObjB4.name = @"Server";
[typesArray addObject:tempObjB4];
[tempObjB4 release];

typesClass *tempObjB5 = [[typesClass alloc] init];
tempObjB5.typeID = 5; 
tempObjB5.name = @"Printer";
[typesArray addObject:tempObjB5];
[tempObjB5 release];

typesClass *tempObjB6 = [[typesClass alloc] init];
tempObjB6.typeID = 6; 
tempObjB6.name = @"Projector";
[typesArray addObject:tempObjB6];
[tempObjB6 release];

typesClass *tempObjB7 = [[typesClass alloc] init];
tempObjB7.typeID = 7; 
tempObjB7.name = @"Other";
[typesArray addObject:tempObjB7];
[tempObjB7 release];


if (roomPicker == nil) {
    roomPicker = [[UIPickerView alloc] initWithFrame:CGRectZero];
    roomPicker.delegate = self;
    roomPicker.dataSource = self;
    roomPicker.showsSelectionIndicator = YES;
    roomPicker.transform = CGAffineTransformMakeScale(1.0, 1.0);
    roomPicker.tag = kRoomPicker;
}

txtRoomID.inputView = roomPicker;


if (typePicker == nil) {
    typePicker = [[UIPickerView alloc] initWithFrame:CGRectZero];
    typePicker.delegate = self;
    typePicker.dataSource = self;
    typePicker.showsSelectionIndicator = YES;
    typePicker.transform = CGAffineTransformMakeScale(1.0, 1.0);
    typePicker.tag = kTypePicker;
}

txtTypeID.inputView = typePicker;
</code></pre>

<p>The idea is to have the picker show some text, but when the user selects the text on the UIPickerView, the integer value/id of the selection be placed in the UITextField, rather than the text the user sees.</p>

<p>I am using iOS 4.3.1 on the device, with 4.3 SDK, and Xcode 3.2.6.</p>
