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

Width of the popview can be larger than the frame with a long title #82

Open
funnel20 opened this issue Dec 2, 2014 · 3 comments
Open

Comments

@funnel20
Copy link
Contributor

funnel20 commented Dec 2, 2014

I have mentioned this behaviour earlier in #58, but I finally found the root cause.

I have used version 2.2.0, but unfortunately it changes the width of the popview in a negative way. Also the property maxWidth is ignored completely.

Examples:
Previous version:
1

Version 2.2.0:
2

On iPhone it's even worse:
old:
3

new:
4

ROOT CAUSE
The code assumes that the title is always a single row. Of course it might contain of so much words, that they have to be defined over multiple rows.

I have solved this by:

  1. Replacing the lineBreakMode for all title related code snippets:
titleParagraphStyle.lineBreakMode = NSLineBreakByWordWrapping;

This occurs in lines: 260, 279, 296, 313, 435 and 452.

  1. Correcting the options for the text frame:
options:NSStringDrawingUsesLineFragmentOrigin

This occurs in lines: 299 and 438.

After these changes the view is shown as expected with a multi-line title.

@ogoldfinger
Copy link

Having the same problem. It looks like the title was never intended to be that long. It's line break mode is set to NSLineBreakByClipping. The problem occurs on line 458:
if (titleSize.width > textSize.width) textSize.width = titleSize.width;

This sets the textSize width to the titleSize's width ignoring the maxWidth.

FYI your fix works for me as well. nice work!

@chrismiles
Copy link
Owner

Can you submit a pull request containing the fix (reference this issue) ?

@funnel20
Copy link
Contributor Author

I can confirm that this was solved in 175d089.
Also the current version aeda632 works fine.

This issue can be closed.

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

3 participants