Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Add reading of contentHorizontalAlignment/contentVerticalAlignment UIControl properties from xib3/storyboard files#1080

Merged
oliversa-msft merged 1 commit into
microsoft:developfrom
ehren:uicontrol-alignment-xib
Oct 19, 2016
Merged

Add reading of contentHorizontalAlignment/contentVerticalAlignment UIControl properties from xib3/storyboard files#1080
oliversa-msft merged 1 commit into
microsoft:developfrom
ehren:uicontrol-alignment-xib

Conversation

@ehren

@ehren ehren commented Oct 4, 2016

Copy link
Copy Markdown
Contributor

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

@rajsesh

rajsesh commented Oct 4, 2016

Copy link
Copy Markdown
Contributor

@jaredhms is added to the review. #Closed

@rajsesh

rajsesh commented Oct 4, 2016

Copy link
Copy Markdown
Contributor

@tadam-msft is added to the review. #Closed

@jaredhms

Copy link
Copy Markdown
Contributor

@oliversa-msft is added to the review. #Closed

_contentVerticalAlignment = (int)UIControlContentVerticalAlignmentFill;
} else {
assert(0);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oliver, can you share a better way to fail here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically we use printf statements to log it

@oliversa-msft oliversa-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor updates

Comment thread tools/vsimporter/xib2nib/UIControl.cpp Outdated
getAttrAndHandle("contentHorizontalAlignment");
}

const char* verticalAlign = getAttrib("contentVerticalAlignment");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to getAttribAndHandle(...)

Comment thread tools/vsimporter/xib2nib/UIControl.cpp Outdated
} else if (strcmp(verticalAlign, "fill") == 0) {
_contentVerticalAlignment = (int)UIControlContentVerticalAlignmentFill;
} else {
assert(0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread tools/vsimporter/xib2nib/UIControl.cpp Outdated
} else {
assert(0);
}
getAttrAndHandle("contentHorizontalAlignment");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue getAttrAndHandle (line 40) in the initial call and then remove this line. Do the same for verticalAlign.

_contentVerticalAlignment = (int)UIControlContentVerticalAlignmentFill;
} else {
assert(0);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically we use printf statements to log it

Comment thread tools/vsimporter/xib2nib/UIControl.h Outdated
UIControlContentHorizontalAlignmentRight = 2,
UIControlContentHorizontalAlignmentFill = 3,
} _UIControlContentHorizontalAlignment;
typedef unsigned UIControlContentHorizontalAlignment;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do it this way instead of just typedef enum {.....} UIControlContentHorizontalAlignment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those were copied from the Framework/UIKit headers - changed in rebase

Comment thread tools/vsimporter/xib2nib/UIControl.h Outdated
UIControlContentVerticalAlignmentBottom = 2,
UIControlContentVerticalAlignmentFill = 3,
} _UIControlContentVerticalAlignment;
typedef unsigned UIControlContentVerticalAlignment;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same change as above

…Control properties from xib3/storyboard files
@ehren ehren force-pushed the uicontrol-alignment-xib branch from f7032fd to 92a4735 Compare October 13, 2016 13:07
@ehren

ehren commented Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

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

@oliversa-msft oliversa-msft merged commit 044b7bf into microsoft:develop Oct 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants