I'm using a library for message cells in Obj-C and I'm bridging from Swift. Here are the 2 lines of code I'm trying to convert to iOS8 compatibility.
+(CGSize)messageSize:(NSString*)message {
return [message sizeWithFont:[UIFont systemFontOfSize:messageTextSize] constrainedToSize:CGSizeMake([PTSMessagingCell maxTextWidth], CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
}
and
CGSize dateSize = [self.timeLabel.text sizeWithFont:self.timeLabel.font forWidth:[PTSMessagingCell maxTextWidth] lineBreakMode:NSLineBreakByClipping];
My attempt for both are as follows. I'm not a seasoned Obj-C coder, so go easy on me.
+(CGSize)messageSize:(NSString*)message {
return [message sizeWithAttributes:@{NSFontAttributeName:PTSMessagingCell}];
}
and
CGSize dateSize = [self.timeLabel.text sizeWithAttributes:@{NSFontAttributeName:PTSMessagingCell}];
Are my attempts correct translations of the first 2 snippets?