ios - UIPickerView appears empty -


i have view 2 pickers, , using ...viewforrow... modify fonts text appears inside picker. however, 1 of pickers appears empty, if scroll through picker, values appear in designated textfields. other picker appears fine. wondering why 1 of picker appears empty?

note picker appears empty has 2 components. it's credit card expiration date picker, has 1 component month , 1 year.

here code ...viewforrow... method:

- (uiview *)pickerview:(uipickerview *)pickerview viewforrow:(nsinteger)row forcomponent:(nsinteger)component reusingview:(uiview *)view {     uilabel *pickerlabel = (uilabel *)view;      if (pickerlabel == nil)     {         //label size         cgrect frame = cgrectmake(0.0, 0.0, 280, 30);          pickerlabel = [[uilabel alloc] initwithframe:frame];         [pickerlabel settextalignment:uitextalignmentleft];         [pickerlabel setbackgroundcolor:[uicolor clearcolor]];          [pickerlabel setfont:[uifont fontwithname:@"helvetica" size:11.0]];     }      if ([pickerview isequal:pickerexpiration])     {         if (component == 0)         {             [pickerlabel settext:[nsstring stringwithformat:@"%@", [monthslist objectatindex:row]]];         }         [pickerlabel settext:[nsstring stringwithformat:@"%@", [yearslist objectatindex:row]]];          return pickerlabel;     }      billingaddress = [addresses objectatindex:row];     [pickerlabel settext:[nsstring stringwithformat:@"%@ %@", billingaddress.addressname, billingaddress.fulladdresstext]];     return pickerlabel; } 

any tips appreciated.

figured out. because, picker has 2 components , label, making via 'pickerlabel' big 2 component picker. so, had split width of cgrect two, , worked.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -