iOS uses attributedText attributes with labels / text fields
on OSX use attribStringValue
you can list attributedText attributes and check each attribute. Ill hack some code (osx and iOS)
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"none "]; id temp = [[NSAttributedString alloc] initWithString:@"bold " attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:12]}]; [str appendAttributedString:temp]; temp = [[NSAttributedString alloc] initWithString:@"italic " attributes:@{NSFontAttributeName: [UIFont italicSystemFontOfSize:12]}]; [str appendAttributedString:temp]; temp = [[NSAttributedString alloc] initWithString:@"none " attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12]}]; [str appendAttributedString:temp]; temp = [[NSAttributedString alloc] initWithString:@"bold2 " attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:12]}]; [str appendAttributedString:temp]; self.label.attributedText = str; NSMutableString *italics = [NSMutableString string]; NSMutableString *bolds = [NSMutableString string]; NSMutableString *normals = [NSMutableString string]; for (int i=0; i<str.length; i++) {
Now here's how to find it. Selecting a range of choices from this should be easy peasy :)
Note: you can only have continuous choices! neither on osx nor on ios you can select n parts of the text field / textview
source share