iphone - My Picker shows question marks, but still sends the proper info to my Label -
i made simple picker displays information chose in label on same page. picker showing ? ? ?, when scroll on ? shows correct things chosen in label. how show words in pickerwheel itself?
without seeing code, difficult track down. how setting information in label , picker?
if have array of strings displayed in picker, easy:
in .h file, use:
@interface viewcontroller : uiviewcontroller <uipickerviewdatasource, uipickerviewdelegate>{ nsarray * arrayofstring; uilabel * thelabel; uipicker * thepicker; }
in .m file, use:
#pragma mark - #pragma mark view - (void)viewdidload;{ [super viewdidload]; arrayofstrings = [[nsarray alloc] initwithobjects:@"1", @"2", @"etc", nil]; } #pragma mark - #pragma mark picker delegate methods - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)thepickerview; { return [arrayofstrings count]; } - (nsinteger)pickerview:(uipickerview *)thepickerview numberofrowsincomponent:(nsinteger)component; { return 1; } - (nsstring *)pickerview:(uipickerview *)thepickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component; { return [arrayofstrings objectatindex:row]; } - (void)pickerview:(uipickerview *)thepickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component; { thelabel.text = [arrayofstrings objectatindex:row]; }
you hook in nib, , should fix problem. hope helps!
Comments
Post a Comment