TSMessages icon indicating copy to clipboard operation
TSMessages copied to clipboard

Add text alignment support

Open ricardopereira opened this issue 11 years ago • 13 comments

(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 avatar Feb 14 '14 12:02 ricardopereira

ios simulator screen shot 14 feb 2014 12 22 32

ricardopereira avatar Feb 14 '14 12:02 ricardopereira

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 ?

dennisreimann avatar Feb 15 '14 06:02 dennisreimann

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: https://github.com/toursprung/TSMessages/issues/54

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

KrauseFx avatar Feb 16 '14 10:02 KrauseFx

I will abort this pull request and rethink about it.

ricardopereira avatar Feb 18 '14 16:02 ricardopereira

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 :+1:

KrauseFx avatar Feb 19 '14 18:02 KrauseFx

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.

ricardopereira avatar Feb 20 '14 02:02 ricardopereira

@dennisreimann this feature should be in 1.0

mRs- avatar Apr 03 '14 13:04 mRs-

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

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

dennisreimann avatar Apr 03 '14 14:04 dennisreimann

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

fukemy avatar Oct 02 '17 04:10 fukemy

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

ricardopereira avatar Oct 02 '17 13:10 ricardopereira

@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).

isadon avatar Oct 02 '17 15:10 isadon

@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];

fukemy avatar Oct 03 '17 06:10 fukemy

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

ricardopereira avatar Oct 04 '17 10:10 ricardopereira