ios - Assigning data to the buttons from service Objective C -
i have 4 buttons(date1, date2, time1 , time2) , 3 labels, can assign labels given output
_lblname.text = [medicationdicts objectforkey:@"name"]; _lblmedicine.text = [medicationdicts objectforkey:@"medicine"]; _lbldate.text = [medicationdicts objectforkey:@"expdate"];
but, how can assign date , time buttons like(date1 = 2017-04-05, date2 = 2017-04-06, time1 = 07:00:00 , time2 = 07:10:00) following output
name = abhi; medicine = colpol; time = ( { date = "2017-04-05"; time = "07:00:00"; }, { date = "2017-04-06"; time = "07:10:00"; } ); expdate = "2017-04-30";
help me solve issues. tia
you can this...
nsarray *times = [medicationdicts objectforkey:@"time"]; (nsdictionary *timedict in times) { nsstring *time = [timedict objectforkey:@"date"]; nsstring *date = [timedict objectforkey:@"time"]; if ([times indexofobject:timedict] == 0) { [datebutton1 settitle: date forstate: uicontrolstatenormal]; [timebutton1 settitle: time forstate: uicontrolstatenormal]; } else { [datebutton2 settitle: date forstate: uicontrolstatenormal]; [timebutton2 settitle: time forstate: uicontrolstatenormal]; } }
Comments
Post a Comment