ios - Assign a label to the text of a UIDatePicker -


i have uidatepicker in i'm trying make scroll horizontally instead of vertically. found this tutorial shows how uipickerview not uidatepicker.

the problem have following line:

label.text = [pickerviewarray objectatindex:row]; 

what put in label.text =? there isn't array can assign 'label`.

here full method got tutorial.

- (uiview *)pickerview:(uipickerview *)pickerview viewforrow:(nsinteger)row forcomponent:(nsinteger)component reusingview:(uiview *)view{     cgrect rect = cgrectmake(0, 0, 120, 80);     uilabel *label = [[uilabel alloc]initwithframe:rect];     cgaffinetransform rotate = cgaffinetransformmakerotation(3.14/2);     rotate = cgaffinetransformscale(rotate, 0.25, 2.0);     [label settransform:rotate];     label.text = [pickerviewarray objectatindex:row];     label.font = [uifont systemfontofsize:22.0];     label.textalignment = uitextalignmentcenter;     label.numberoflines = 2;     label.linebreakmode = uilinebreakmodewordwrap;     label.backgroundcolor = [uicolor clearcolor];     label.clipstobounds = yes;     return label ; } 

nsdateformatter *formatter;  formatter = [[nsdateformatter alloc] init];  [formatter setdateformat:@"dd/mm/yyyy"];   yourlabel.text = [nsstring stringwithformat:@"%@",[formatter stringfromdate:[birthdaypicker date]]]; 

i think trying like this example

[self.dateformatter setdateformat:@"ee/yyyy"]; // sun/2015 

or

[self.dateformatter setdateformat:@"ee/yy"]; // sun/15 

and here u can set current date , start/end date picker

[self.daypicker setstartdate:[nsdate datefromday:31 month:5 year:2015] enddate:[nsdate datefromday:5 month:6 year:2016]];  [self.daypicker setcurrentdate:[nsdate datefromday:31 month:5 year:2015] animated:no]; 

enter image description here


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -