MTPopupWindow icon indicating copy to clipboard operation
MTPopupWindow copied to clipboard

Scaling issue, behavior of contentSize changed in iOS7

Open algekrans opened this issue 12 years ago • 0 comments

Scaling of MTPopupWindow broken since iOS7.

Got it working by changing the resizing code in -(void)doTransitionWithDictionary:(NSDictionary *)dictionary

to following code:

UITextView* textViewToMeasureWith = [[UITextView alloc] initWithFrame:CGRectZero]; [textViewToMeasureWith setFont:[UIFont systemFontOfSize:16]]; [textViewToMeasureWith setText:[dictionary objectForKey:kMessage]];

CGFloat height = [textViewToMeasureWith sizeThatFits:CGSizeMake(290, CGFLOAT_MAX)].height;
[textViewToMeasureWith release];

CGRect newFrame = messageTextView.frame;
// Set the textView frame to the proper size
if (height > 380)
{
    newFrame.size.height = 380;
    [messageTextView setScrollEnabled:YES];
}
else
{
    newFrame.size.height = height;
    [messageTextView setScrollEnabled:NO];
}
messageTextView.frame = newFrame;

algekrans avatar Nov 03 '13 21:11 algekrans