Skip to content

Add text alignment support #108

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

ricardopereira
Copy link

(NSTextAlignment) messageAlign

It’s possible to change the alignment on initWithTitle and customize it
on the layout:

  • "textAlignment": 2 //NSTextAlignmentRight

The layout has priority.

Examples updated too!

@ricardopereira
Copy link
Author

ios simulator screen shot 14 feb 2014 12 22 32

@dennisreimann
Copy link
Contributor

Thanks for the adition, @ricardopereira!

Did you consider to not only align the text but the icon too? I could imagine this to work analog to the UIControl contentHorizontalAlignment property, which aligns image and text.

This isn't about these changes but more of a general issue I see: I think we need to keep the designated initializer from growing, as every new feature/property gets added onto it. This would be kind of a bigger change I image which would also break the public API, but I think it makes sense to discuss it in a separate issue - what do you think @KrauseFx ?

@KrauseFx
Copy link
Owner

Yes, that's exactly what I'm concerned about. The designated initialiser grows and grows.

There is already an issue with some thoughts about that: #54

I guess a major redesign of the TSMessages library would be necessary for this change.

@ricardopereira
Copy link
Author

I will abort this pull request and rethink about it.

@KrauseFx
Copy link
Owner

Well, it's not something that's your fault or your job. It's something I've been unhappy with TSMessages for a long time now. @dennisreimann and me are working on a better solution, where we can add your great new option for text alignment as well.
I'll keep this issue open, since it might be interesting for other users as well.

Thanks for your contribution 👍

@KrauseFx KrauseFx reopened this Feb 19, 2014
@ricardopereira
Copy link
Author

That's ok. You welcome. I also close it because I made the mistake of committing the feature on the master. I forget to create a new branch. I'm just getting used with github :) Sorry about that.

@KrauseFx KrauseFx mentioned this pull request Feb 22, 2014
@KrauseFx KrauseFx added this to the 1.0 milestone Feb 22, 2014
@mRs-
Copy link
Collaborator

mRs- commented Apr 3, 2014

@dennisreimann this feature should be in 1.0

@mRs- mRs- added the feature label Apr 3, 2014
@dennisreimann dennisreimann modified the milestone: 1.0 Apr 3, 2014
@dennisreimann
Copy link
Contributor

Yes, @KrauseFx already assigned it to that milestone :)

Right now I don't have any time to work on TSMessages though... :(

Kirian and others added 2 commits July 7, 2015 11:27
HexColors in 2.3 version has renamed his file hexColor.h to hexColors.h
Also, now we can align the text in the TSMessage

- Rename import hexColors.h in TSMessageView
- Update in methods with textAlign property in the TSDemoViewController
Bugfix/hexcolors updated + TSBlurView to UIView
@fukemy
Copy link

fukemy commented Oct 2, 2017

hello. how can i get this pull? current project still display text in left ( ipad)

@ricardopereira
Copy link
Author

@fukemy You can use my fork like pod 'TSMessages', :git => 'https://github.com/ricardopereira/TSMessages.git', :branch => 'master'.

@isadon
Copy link
Collaborator

isadon commented Oct 2, 2017

@fukemy TSMessages is no longer being updated/maintained. We are recommending people migrate to RMessage which for the most part maintains full compatibility with TSMessages apart from embedding a UIButton. Please see the README.md of this repo. As of 2.1.3 RMessage supports text alignment (both the title and subtitle) via the design file and appearance proxy. So check that out. Version 3.0.0 which is not 'master' yet does have support for the UIButton (more generally embedding UIViews).

@fukemy
Copy link

fukemy commented Oct 3, 2017

@ricardopereira i used your code then got this problem. the notify run from bottom -> top. It's not show
I commit my short video here
test.mov.zip

here is my code:
[TSMessage showNotificationInViewController:self
title:@"title"
subtitle:@"Please check the internet connection!"
image:nil
type:TSMessageNotificationTypeError
duration:TSMessageNotificationDurationAutomatic
callback:nil
buttonTitle:nil
buttonCallback:nil
atPosition:TSMessageNotificationPositionTop
canBeDismissedByUser:YES
textAlign:NSTextAlignmentCenter];

@ricardopereira
Copy link
Author

@fukemy Please use this one https://github.com/donileo/RMessage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants