Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Dictionary popup of TUITextRenderer does not work on 10.7.3? #105

Closed
devon opened this Issue · 11 comments

3 participants

Devon galaxas0 Josh Abernathy
Devon

double tap with three fingers with throw exceptions:

2012-04-25 10:22:05.277 Note[78887:403] -[__NSCFType lineBreakMode]: unrecognized selector sent to instance 0x1010be310
objc[78887]: EXCEPTIONS: throwing 0x1010c9d38 (object 0x1010d27d0, a NSException)
objc[78887]: EXCEPTIONS: searching through frame [ip=0x7fff93c6ae79 sp=0x7fff5fbfc800] for exception 0x1010c9d18
objc[78887]: EXCEPTIONS: searching through frame [ip=0x7fff874d9e72 sp=0x7fff5fbfd800] for exception 0x1010c9d18
objc[78887]: EXCEPTIONS: searching through frame [ip=0x10c28bcd4 sp=0x7fff5fbfdbf0] for exception 0x1010c9d18
objc[78887]: EXCEPTIONS: searching through frame [ip=0x10c28e0db sp=0x7fff5fbfdc70] for exception 0x1010c9d18
objc[78887]: EXCEPTIONS: catch(NSException)
objc[78887]: EXCEPTIONS: unwinding through frame [ip=0x7fff93c6ae79 sp=0x7fff5fbfc800] for exception 0x1010c9d18
objc[78887]: EXCEPTIONS: unwinding through frame [ip=0x7fff874d9e72 sp=0x7fff5fbfd800] for exception 0x1010c9d18
objc[78887]: EXCEPTIONS: unwinding through frame [ip=0x10c28bcd4 sp=0x7fff5fbfdbf0] for exception 0x1010c9d18
objc[78887]: EXCEPTIONS: unwinding through frame [ip=0x10c28e0db sp=0x7fff5fbfdc70] for exception 0x1010c9d18
objc[78887]: EXCEPTIONS: handling exception 0x1010c9d18 at 0x10c28e161
2012-04-25 10:22:05.278 Note[78887:403] Lookup: Unhandled exception 'NSInvalidArgumentException' caught in __56+[LULookupDefinitionModule focusTermUsingQueue:handler:]_block_invoke_0
objc[78887]: EXCEPTIONS: finishing handler

galaxas0

Mmm, mind posting the code you used to configure this? (Partially because I haven't been able to get it to work either, and partially to help you :D)

Devon

I tried the latest example from twui, it works. I use and old twui branch(before ARC). I'm trying to figure it out.

galaxas0

Wait, is it enabled automatically? Doesn't seem to do that for me...

Devon

Yeah, it enabled automatically. git clone the latest version from https://github.com/twitter/twui.git, and run the example project.

galaxas0

Oh, I see. I will indeed do that. Was the triple-tap define on the table view cell labels?

Devon

Yeah, triple-tap on the table view, it will show up the dictionary. I think it's related to TUITextRenderer

galaxas0

Alright, will look into that and get back to you. I'm on a desktop at the moment, but tomorrow I'll test it on an MBP running 10.7.3.

Devon

I found the problem. Cannot popup the dictionary when add line height to TUIAttributedString.

ExampleTableViewCell *cell = reusableTableCellOfClass(tableView, ExampleTableViewCell);

TUIAttributedString *s = [TUIAttributedString stringWithString:[NSString stringWithFormat:@"good news cell %d", indexPath.row]];
s.color = [TUIColor blackColor];
s.font = exampleFont1;
s.lineHeight = 3;  // Add the line will see the problem
[s setFont:exampleFont2 inRange:NSMakeRange(8, 4)]; // make the word "cell" bold
cell.attributedString = s;

return cell;
galaxas0

Considerably faster than I could, I see. Now that we know that the issue is here, I can look into fixing it. Thanks!

Devon

Change the setLineheight to use the default method solve the problem, but i'm not sure is this a good solution for this:

- (void)setLineHeight:(CGFloat)f inRange:(NSRange)range
{
    // CTParagraphStyleSetting setting;
    // setting.spec = kCTParagraphStyleSpecifierLineSpacing;
    // setting.valueSize = sizeof(CGFloat);
    // setting.value = &(CGFloat){f};

    // CTParagraphStyleRef paragraphStyle = CTParagraphStyleCreate(&setting, 1);
    // [self addAttributes:[NSDictionary dictionaryWithObjectsAndKeys:(id)paragraphStyle, kCTParagraphStyleAttributeName, nil] range:range];
    // CFRelease(paragraphStyle);
    NSMutableParagraphStyle *p = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
    [p setLineSpacing:f];
    [self addAttributes:[NSDictionary dictionaryWithObjectsAndKeys:(id)p, kCTParagraphStyleAttributeName, nil] range:range];
    [p release];
}
Josh Abernathy
Collaborator

This is fixed after merging #107

Josh Abernathy joshaber closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.