मैं एनएसएट्रिब्यूटेड स्ट्रिंग को कैसे ले सकता हूं और आईपैड पर कोर टेक्स्ट में इसका उपयोग करने का प्रयास कर रहा हूं। मैं WWDC वीडियो में से एक देखा (110) जो स्लाइड्स (लेकिन कोई स्रोत कोड) है और यह बताता है कि किसी NSAttributedString बनाने का तरीका है, तो बस एक CTFramesetterRef में डाल दिया:क्या मैं आईओएस में कोर टेक्स्ट में एनएसएट्रिब्यूटेड स्ट्रिंग का उपयोग कर सकता हूं?
CTFontRef helveticaBold = CTFontCreateWithName(CFSTR("Helvetica-Bold"), 24.0, NULL);
NSString* unicodeString = NSLocalizedString(@"TitleString", @"Window Title");
CGColorRef color = [UIColor blueColor].CGColor; NSNumber* underline = [NSNumber numberWithInt:kCTUnderlineStyleSingle|kCTUnderlinePatternDot];
NSDictionary* attributesDict = [NSDictionary dictionaryWithObjectsAndKeys:helveticaBold, (NSString*)kCTFontAttributeName, color, (NSString*)kCTForegroundColorAttributeName, underline, (NSString*)kCTUnderlineStyleAttributeName, nil];
NSAttributedString* stringToDraw = [[NSAttributedString alloc] initWithString:unicodeString attributes:attributesDict];
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(stringToDraw);
CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
CFRelease(framesetter);
CTFrameDraw(frame, context);
CFRelease(frame);
लेकिन जब मैं यह कोशिश है, यह
Passing argument 1 of 'CTFramesetterCreateWithAttributedString' from incompatible pointer type
CFAttributedString रहे हैं और NSAttributedString 'टोल फ्री पाटने': त्रुटि फेंकता है? मैंने कहीं पढ़ा है कि यह ओएसएक्स पर ही सच है, लेकिन इस तरह ऐप्पल अपने डेमो में ऐसा करता है ...
धन्यवाद!
: -Joe
आप दिखाने के लिए बिंदु वाले रेखांकन प्राप्त करने में सक्षम थे? मुझे केवल पाठ के नीचे सादा एकल रेखांकन मिलता है। – learner2010