Enable top/bottom positioning of the radio icon.#135
Open
MihaiBalint wants to merge 1 commit intoDavydLiu:masterfrom
Open
Enable top/bottom positioning of the radio icon.#135MihaiBalint wants to merge 1 commit intoDavydLiu:masterfrom
MihaiBalint wants to merge 1 commit intoDavydLiu:masterfrom
Conversation
MihaiBalint
commented
May 22, 2018
| * @brief Icon position: Left, Right, Top or Bottom, default to Left. | ||
| * @warning If position is Right, please also set contentHorizontalAlignment to UIControlContentHorizontalAlignmentRight. | ||
| * @warning If position is Top or Bottom, please also set contentVerticalAlignment to UIControlContentVerticalAlignmentTop. | ||
| * @warning If position is Bottom, please also set contentVerticalAlignment to UIControlContentVerticalAlignmentBottom. |
Author
There was a problem hiding this comment.
Not sure about these warnings... Any idea on how to do it better?
| break; | ||
| case IconPositionTop: | ||
| self.imageEdgeInsets = UIEdgeInsetsMake(0, (self.frame.size.width - self.icon.size.width)*0.5, 0, 0); | ||
| self.titleEdgeInsets = UIEdgeInsetsMake(self.icon.size.height, (self.frame.size.width-self.titleLabel.frame.size.width)*0.5 - self.icon.size.width, 0, 0); |
Author
There was a problem hiding this comment.
For now, this only works for left-to-right layouts
|
|
||
| - (void)setIconOnRight:(BOOL)iconOnRight { | ||
| _iconPosition = iconOnRight ? IconPositionRight : IconPositionLeft; | ||
| } |
Author
There was a problem hiding this comment.
This should preserve backwards compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First implementation attempt on getting top/bottom icon positioning to work. This version only works for left-to-right layouts. I created the PR anyway because I wanted to confirm that the implementation is in the correct general direction.