Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting background color of selection via OABackgroundColorAttributeName? #70

Open
memmons opened this issue Apr 20, 2013 · 0 comments
Open

Comments

@memmons
Copy link

memmons commented Apr 20, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant