nsstring* Alerttext = [NSString stringWithFormat:@"the following%d courses (total paid ¥%.02lf) parents have not yet been taught and evaluated, please contact the parents as soon as possible, otherwise you will not be able to obtain the remuneration. ", Self.coursenum,self.totalprice]; Nsmutableattributedstring* Alertstring =[[Nsmutableattributedstring Alloc]initwithstring:alerttext]; Nsrange Totalrange= Nsmakerange (0, alertstring.length); [Alertstring addattributes:@{nsfontattributename:[uifont systemfontofsize:16.0],nsforegroundcolorattributename:[uicolor Themepinkcolor]} Range:totalrange];
Add an icon to the front of the text nstextattachment* Textattachment =[[Nstextattachment Alloc]initwithdata:nil Oftype:nil]; UIImage* Alerticon = [UIImage imagenamed:@"Lesson_icon26"]; Textattachment.image=Alerticon; Textattachment.bounds= CGRectMake (0,-5, Kalerticonheight, kalerticonheight); [alertstring insertattributedstring:[nsattributedstring attributedstringwithattachment:textattachment] AtIndex: 0]; Self.alertLabel.attributedText= alertstring;
iOS WordArt and simple picture-and-text blending