2016-02-12 7 views
5

मैं एक्सेसिबिलिटी एपीआई का उपयोग करके कोको में कुछ स्वरूपित टेक्स्ट डालने की कोशिश कर रहा हूं। यह मैं क्या किया है है:कोको में अभिगम्यता API का उपयोग करके स्वरूपित पाठ डालना?

NSFont *font = [NSFont fontWithName:@"Arial" size:14.0]; 
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; 
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"hello, world" attributes:attrsDictionary]; 
AXError error = AXUIElementSetAttributeValue(element, kAXValueDescriptionAttribute, attrString); 
// element is an instance of 'AXUIElementRef' with role 'AXTextArea' 

त्रुटि मैं हमेशा मिलता kAXErrorIllegalArgument (-25201) है। अगर मैं गैर प्रारूपित पाठ डालने का प्रयास करता हूं तो यह ठीक काम करता है।

तो, क्या कोई जानता है कि एक्सेसिबिलिटी एपीआई का उपयोग करके स्वरूपित टेक्स्ट कैसे सम्मिलित किया जाए?

+0

आपका kAXValueDescriptionAttribute क्या है? –

+0

@ जोनासस्काफ्ट kAXValueDescriptionAttribute एक स्थिर है। – ashokgelal

+0

@ कमलदीपसिंहबतिया हां, मैं स्वरूपित "हैलो, दुनिया" डालने की कोशिश कर रहा हूं – ashokgelal

उत्तर

0

मुझे नहीं लगता कि आप एक विशेषता स्ट्रिंग में विवरण, मान या शीर्षक सेट कर सकते हैं। शायद आप AXUIElementCopyParameterizedAttributeValue के साथ जिम्मेदार स्ट्रिंग प्राप्त कर सकते हैं लेकिन AXUIElementSetParameterizedAttributeValue नहीं है।

संबंधित मुद्दे