ios - UILabel not getting what I write to it -
tricky write subject this. guess basic question can't seem find answer. code shows wanna , uilabel don't show anything, first line add works fine, not when try write out array:
-(ibaction)getsonghistory:(id)sender { [historylabel settext:@"test write\n test write line"]; nsarray *pastmusicarray = [pastsongs gethistory]; for(int t=2; t<[pastmusicarray count]; t++) { nsstring *temprow = [pastmusicarray objectatindex:t]; //nslog(@"%@", temprow); [historylabel settext:temprow]; [historylabel settext:@"\n"]; }
}
the nslog put out right stuff. gong on here, not seeing?
seems me problem setting full text each time , last settext: @"\n" invisible string. try appending instead of setting text. like:
historylabel.text = [nsstring stringwithformat:@"%@%@", historylabel.text,@"texttoappend"];
this append @"texttoappend" current text value in label.
update: notice i'm using text property rather setter.
historylabel.text = @"some text";
is equivalent to
[historylabel settext:@"some text"];
Comments
Post a Comment