uicolor - iOS attributedText for 5.1 -
this question has answer here:
- bold & non-bold text in single uilabel? 12 answers
how can make in ios 5.1 -
nsstring *statusstrcolored = [nsstring stringwithformat:@"%@ (%@)", statusstr, paymentstatusstr]; nslog(@"stoka = %@", statusstrcolored); //nsarray *components = [statusstrcolored componentsseparatedbystring:@" "]; nsrange greenrange = [statusstrcolored rangeofstring:statusstr]; nsrange redrange = [statusstrcolored rangeofstring:paymentstatusstr]; nsmutableattributedstring *attrstring1 = [[nsmutableattributedstring alloc] initwithstring:statusstrcolored]; [attrstring1 beginediting]; [attrstring1 addattribute: (nsstring*)kctforegroundcolorattributename value:(id)[[uicolor greencolor] cgcolor] range:greenrange]; [attrstring1 addattribute: (nsstring*)kctforegroundcolorattributename value:(id)[[uicolor redcolor] cgcolor] range:redrange]; [attrstring1 endediting]; cell.textlabel.attributedtext = attrstring1;
in ios 6 ok, in 5.1 ... not available(((
and have error on code -
cell.textlabel.attributedtext = attrstring1;
may have analog in ios 5.1?
look @ using dtcoretext backwards compatible attributed string , htmlish handling.
Comments
Post a Comment