lostInTransit
lostInTransit

Reputation: 71027

TTStyledTextLabel - unrecognized selector exception

I am using the 2.x compatible branch of Three20 library. I want to display a URL and am using the TTStyledTextLabel for this purpose.

However when trying to use it, I get an exception

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[TTStyledTextLabel width]: unrecognized selector sent to instance 0x4bc440'

This is how I am using the TTStyledTextLabel object (inside a custom tableviewcell)

TTStyledTextLabel *textLabel = (TTStyledTextLabel *)[cell.contentView viewWithTag:2];
[textLabel setText:[TTStyledText textFromXHTML:myFormattedText lineBreaks:YES urls:YES]];

Can someone please tell me why this exception occurs?

Thanks.

Upvotes: 2

Views: 799

Answers (2)

Ross
Ross

Reputation: 14425

I had the same problem, caused due to the Three20 UIViewAdditions categories not being applied.

Check that you have added the -ObjC flag to your "Other Linker Flags" build. I had it missing.

There is more information on these categories not being applied on a Three20's google groups thread

Upvotes: 0

lyonanderson
lyonanderson

Reputation: 2035

The width member is added by the category UIViewAdditions on UIView. Can you check that it's there in this release?

Upvotes: 1

Related Questions