-
Notifications
You must be signed in to change notification settings - Fork 714
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
Text alignment is broken #68
Comments
I think a method just change UIView+Toast.m line 237 expectedSizeTitle = CGSizeMake(MAX(maxSizeTitle.width, expectedSizeTitle.width), MIN(maxSizeTitle.height, expectedSizeTitle.height)); but i don't know whether it has a bad effect, you can try it. |
Hi, has this been fixed? I've integrated toast using Pods, and title alignment does not seem to do anything. I've tried left, right and centre. |
I have solved this issue in version 4.0.0 in: The details of the change are in PR #118. ExampleI used the Example project to test the changes for DEMO button // Customise the Toast via a style:
CSToastStyle *style = [[CSToastStyle alloc] initWithDefaultStyle];
style.titleAlignment = NSTextAlignmentCenter;
style.messageAlignment = NSTextAlignmentLeft;
style.horizontalPadding = 10;
style.maxWidthPercentage = 0.82;
// Make toast with a title
[self.navigationController.view makeToast:@"This is a piece of toast with a title"
duration:20.0
position:CSToastPositionTop
title:@"Toast Title"
image:nil
style:style
completion:nil]; Current situationWhen running this in 4.0.0, despite setting SolutionAfter my code fix, the title is centred correctly: Bonus: this fixes moreMy fix also solves a padding issue in version 4.0.0. It definitely fails to comply to ValidationHere are examples of other settings for With an image, both title and message right aligned and padding set to 30: |
* The key it to use the same width for both UILabels. This will be the largest value of the 2 expected widths based on the text content. * The available width for the UILabel was too large; the style.horizontalPadding wasn't respected.
@scalessec Hi, any reaction would be appreciated. |
* The key it to use the same width for both UILabels. This will be the largest value of the 2 expected widths based on the text content. * The available width for the UILabel was too large; the style.horizontalPadding wasn't respected.
@scalessec Dear Charles, not only didn't you provide any reaction to my proposed solution or pull request, you also totally neglected my contribution when you updated your repo to version 4.1.x. Can you tell me what would be required to get this resolution in an official release? |
As mention in #53, if the title or message is shorter than the width of the wrapper view, it does not appear to be centered.
The text was updated successfully, but these errors were encountered: