I have a small iOS converter with a UIPickerView (three columns) and a button to allow swapping the first and third columns (I swap the two corresponding arrays of UILabels)
Under iOS4.3 iphone simulator, Everything is all right. When I use the iOS 5.1 simulator there is a display problem(there was also a problem in displaying iVars with LLDB, which vanishes using GDB instead):
After swapping first and third array, the 6 UILabels are active in the first column of UIPickerView (array: pickerColumn1) but three of the text labels are not displayed...
Declaration of the three arrays for managing the UIPickerView three columns:
// File: MesureViewController.h
@interface MesureViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {
IBOutlet UIPickerView *pickerView;
NSArray *pickerColumn1;
NSArray *pickerColumn2;
NSArray *pickerColumn3;
// (...)
}
@property (nonatomic, retain) NSArray *pickerColumn1;
@property (nonatomic, retain) NSArray *pickerColumn2;
@property (nonatomic, retain) NSArray *pickerColumn3;
// File: MesureViewController.m
@implementation MesureViewController
@synthesize pickerColumn1;
@synthesize pickerColumn2;
@synthesize pickerColumn3;
UiPickerView arrays initialization (in a method called by viewDidLoad):
NSArray *contenants=[[NSArray alloc] initWithObjects:c_cafe, c_dessert, c_soupe, tasse, gtasse, bol, v_liqueur,v_moutarde, v_grand, nil];
NSArray *ingredients=[[NSArray alloc] initWithObjects: farine, sucre, beurre, marga, huile, creme, rape, fecule, semoule, f_sec_pile, sel, cereale, fruitfrais, miel, siropErable, cacao, cafe, riz, liquide , nil];
NSArray *mesures=[[NSArray alloc] initWithObjects: kilo, gramme, litre, dl, cl, ml, nil];
self.pickerColumn1=contenants; // 9 objects
self.pickerColumn2=ingredients; // 19 objects
self.pickerColumn3=mesures; // 6 objects
[contenants release];
[ingredients release];
[mesures release];
Code used to swap the first and third array
- (IBAction) swapUnits { // swap first and third arrays
NSArray *tmp=[self.pickerColumn1 retain];
self.pickerColumn1=self.pickerColumn3;
self.pickerColumn3=tmp;
[tmp release];
// (...)
}
Any idea? Thanks!
Denis