ios - how to call a method that returns NSMutableAttributedString -


i have create method create nsmutableattributedstring partly bolded. having trouble calling return data should.

this how have implements code

//.h // creates bold portion of labels in toolbar - (nsmutableattributedstring *)createboldstring:(nsstring *)labelstring intrangea:(int)rangea intrangeb:(int)rangeb;      //.m         - (nsmutableattributedstring *)createboldstring:(nsstring *)labelstring intrangea:(int)rangea intrangeb:(int)rangeb {             // ios6 , above : use nsattributedstrings             const cgfloat fontsize = 12;             uifont *boldfont = [uifont boldsystemfontofsize:fontsize];             uifont *regularfont = [uifont systemfontofsize:fontsize];             uicolor *foregroundcolor = [uicolor whitecolor];              // create attributes             nsdictionary *attrs = [nsdictionary dictionarywithobjectsandkeys:                                    boldfont, nsfontattributename,                                    foregroundcolor, nsforegroundcolorattributename, nil];             nsdictionary *subattrs = [nsdictionary dictionarywithobjectsandkeys:                                       regularfont, nsfontattributename, nil];             const nsrange range = nsmakerange(rangea, rangeb); // range of " 2012/10/14 ". ideally should not hardcoded              // create attributed string (text + attributes)             nsmutableattributedstring *attributedtext =             [[nsmutableattributedstring alloc] initwithstring:labelstring                                                    attributes:attrs];             [attributedtext setattributes:subattrs range:range];              // set in our uilabel , done!             return attributedtext;         //    [firsttoolbarlabel setattributedtext:attributedtext];         } 

and how trying call without sucsess

nsattributedstring *firstattr = [[nsattributedstring alloc] init];     [firstattr create.... // dose not auto complete , cannot see method 

i dont know why cannot use method created. doing right? there different way pass data or missing something

any appreciated.

you want call [self create...], not [firstattr create...]. create... method instance method of object (self). returns attributed string, not method of attributed string class.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -