Add reading of contentHorizontalAlignment/contentVerticalAlignment UIControl properties from xib3/storyboard files#1080
Conversation
|
@jaredhms is added to the review. #Closed |
|
@tadam-msft is added to the review. #Closed |
|
@oliversa-msft is added to the review. #Closed |
| _contentVerticalAlignment = (int)UIControlContentVerticalAlignmentFill; | ||
| } else { | ||
| assert(0); | ||
| } |
There was a problem hiding this comment.
Oliver, can you share a better way to fail here?
There was a problem hiding this comment.
Typically we use printf statements to log it
oliversa-msft
left a comment
There was a problem hiding this comment.
A few minor updates
| getAttrAndHandle("contentHorizontalAlignment"); | ||
| } | ||
|
|
||
| const char* verticalAlign = getAttrib("contentVerticalAlignment"); |
There was a problem hiding this comment.
Change to getAttribAndHandle(...)
| } else if (strcmp(verticalAlign, "fill") == 0) { | ||
| _contentVerticalAlignment = (int)UIControlContentVerticalAlignmentFill; | ||
| } else { | ||
| assert(0); |
There was a problem hiding this comment.
We typically don't assert even though we might have a few legacy places where this is still done. Instead, just replace it with printf("Unknown verticalightment value: %s\n", verticalAlign) for now
| } else { | ||
| assert(0); | ||
| } | ||
| getAttrAndHandle("contentHorizontalAlignment"); |
There was a problem hiding this comment.
Issue getAttrAndHandle (line 40) in the initial call and then remove this line. Do the same for verticalAlign.
| _contentVerticalAlignment = (int)UIControlContentVerticalAlignmentFill; | ||
| } else { | ||
| assert(0); | ||
| } |
There was a problem hiding this comment.
Typically we use printf statements to log it
| UIControlContentHorizontalAlignmentRight = 2, | ||
| UIControlContentHorizontalAlignmentFill = 3, | ||
| } _UIControlContentHorizontalAlignment; | ||
| typedef unsigned UIControlContentHorizontalAlignment; |
There was a problem hiding this comment.
Why do it this way instead of just typedef enum {.....} UIControlContentHorizontalAlignment?
There was a problem hiding this comment.
those were copied from the Framework/UIKit headers - changed in rebase
| UIControlContentVerticalAlignmentBottom = 2, | ||
| UIControlContentVerticalAlignmentFill = 3, | ||
| } _UIControlContentVerticalAlignment; | ||
| typedef unsigned UIControlContentVerticalAlignment; |
There was a problem hiding this comment.
Same change as above
…Control properties from xib3/storyboard files
f7032fd to
92a4735
Compare
|
@oliversa-msft thanks for the review. rebase handles the above comments (and also replaces two additional uses of an integer literal in UIControl.cpp with the enum constants). |
This is related to issue #589. Note that commit 40d4d76 fixes most of the issues with UITextField vertical alignment (after that commit, UITextField properly handles _contentVerticalAlignment).