Skip to content

Setting background color of selection via OABackgroundColorAttributeName? #70

Description

@memmons

This code sitting on our OUIEditableFrame subclass is working in production to set the background color of the current selection, but doesn't work testing it on the latest Omni build. Is there a new design pattern that achieves the same result?

- (void) setTextBackgroundColorForCurrentSelectionToColor:(UIColor *)aColor {
   UITextRange *selectedRange = [self selectedTextRange];

   if (!selectedRange.isEmpty)
      [self setValue:(id)aColor.CGColor forAttribute:OABackgroundColorAttributeName inRange:selectedRange];
}

To test I used the TextEditor sample and created a custom menu item that displays when there is a selection. Selecting the menu item calls this method with [UIColor yellowColor]. The background color doesn't change, however.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions