1

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

Denis
  • 775
  • 7
  • 22
  • Please show the property declarations for the three arrays, and any custom accessors if you have written them. – jrturton Mar 18 '12 at 17:05
  • Thanks. Will add these I soon as I'm authorized for that (answer to an own question) – Denis Mar 18 '12 at 20:17
  • 1
    Don't answer the question to add details. Edit your question instead. Answers should be for answers to the question only. – Matthias Bauch Mar 18 '12 at 20:26
  • You've added some code (which is useful) but ignored my original comment - what are the property declarations for the three arrays? – jrturton Mar 19 '12 at 09:49
  • 1
    Do you use GDB or LLDB for debugging? are the memory readouts identically when you switch debugger? (there are some issues with ivar readouts in LLDB) – Martin Ullrich Mar 19 '12 at 10:41
  • Sorry jrturton. Added the var and property declarations. – Denis Mar 19 '12 at 14:54
  • Updated the Question after verifying what Martin Ulrich wrote: ivar readout is correct with GDB (and not with LLDB) – Denis Mar 19 '12 at 15:13

0 Answers0