objective c - How to display history from UITextField using UILabels? -
so have 3 uitextfields
in 1 view of application , 5 labels in view. purpose of app user input 3 lines of text , make cool animated stuff. i'm trying record/display 5 recent entries user has made in view labels. in other words, i'd show 5 previous things user has put app using textfields.
i display text in each label using format (string textfield1, string 2, string 3). thinking using nsuserdefaults
accomplish this. if point me in right direction i'd appreciate it, thank you! also, if need me clarify let me know.
here's i'm doing now...
- (ibaction)dismissuserinputpage { link4 = [cadisplaylink displaylinkwithtarget:self selector:@selector(movetextinputdown)]; [link4 addtorunloop:[nsrunloop currentrunloop] formode:nsrunloopcommonmodes]; [link3 invalidate]; userinputbutton2.hidden = yes; userinputbutton1.hidden = no; nsstring *line1 = textfield1.text; nsstring *line2 = textfield2.text; nsstring *line3 = textfield3.text; nsuserdefaults *line1text = [nsuserdefaults standarduserdefaults]; [line1text setobject:line1 forkey:@"line1text"]; nsuserdefaults *line2text = [nsuserdefaults standarduserdefaults]; [line2text setobject:line2 forkey:@"line2text"]; nsuserdefaults *line3text = [nsuserdefaults standarduserdefaults]; [line3text setobject:line3 forkey:@"line3text"]; } - (ibaction)presenthistoryview { historyview.hidden = no; [uiview beginanimations:nil context:null]; [uiview setanimationduration:0.5]; historyview.alpha = 1.0; [uiview commitanimations]; historybutton1.hidden = yes; historybutton2.hidden = no; nsuserdefaults *line1text = [nsuserdefaults standarduserdefaults]; nsstring *tempstring1 = [line1text stringforkey:@"line1text"]; nsuserdefaults *line2text = [nsuserdefaults standarduserdefaults]; nsstring *tempstring2 = [line2text stringforkey:@"line2text"]; nsuserdefaults *line3text = [nsuserdefaults standarduserdefaults]; nsstring *tempstring3 = [line3text stringforkey:@"line3text"]; historylabel1.text = [nsstring stringwithformat:@"%@, %@, %@", tempstring1, tempstring2, tempstring3]; }
the problem don't know how move first entry down label when user inputs more text.
store array of dictionaries key value pair being text want store , nsdate. can sort array date time , pick of latest n need.
Comments
Post a Comment