Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change includes the addition of a few new features to UIButton. …
…Some functionality deviates from the reference platform, but we feel that it aligns more closely with the default look and feel of Xaml buttons on Windows because buttons 'look' pressed in more cases with these changes, and there are straightforward ways to opt out of this behavior if it's not desired. **adjustsImageWhenDisabled/adjustsImageWhenHighlighted**: We're adding WinObjC-specific support for adjustsImageWhenDisabled and adjustsImageWhenHighlighted. On the reference platform, this tinting/darkening behavior is ONLY applied to the button's background an foreground images, but on our platform, the tintening/darkening is applied to the entire button's bounds (including its background color), but NOT to its label text. The primary justification for this approach is that there's not a straighforward way to tint Xaml Images on RS1, yet this approach also helps us implement simple SystemButton support and it makes UIButtons appear a bit more 'windows-like' in many cases, since they show more distinct pressed behavior. The behavior is as follows; if adjustsImageWhenDisabled is set to YES, and if no UIControlStateDisabled properties are set on the button, then the entire button contents (aside from its label) receives a lightening effect. Similar behavior is implemented for adjustsImageWhenHighlighted. The way to opt-out of this behavior is to either set a single UIControlStateDisabled/UIControlStateHighlighted property, or to set adjustsImageWhenDisabled/adjustsImageWhenHighlighted to NO. **SystemButton (aka buttonWithType)**: We're adding support for UIButtonTypeSystem, which behaves as follows: - Default background is white. - Receives a default text color of (blue/green) [UIColor colorWithRed:0.0f green:0.47843137f blue:1.0f alpha:1.0f] which applies to all states (unless set otherwise) - Default to UIColor lightTextColor for disabled titleLabelColor **SystemButton - Deviations from the Reference Platform**: - When selected, the entire label background turns the default text color (blue/green) [UIColor colorWithRed:0.0f green:0.47843137f blue:1.0f alpha:1.0f], and the text color is changed to white. This seems like a corner case that we're not implementing until we need to for a customer. - When highlighted, the titleLabel contents (its text and any sublayer content) are tinted to a darker/greyed out version of the normal state. - Instead of this behavior, we're piggy-backing off of our adjustsImageWhenHighlighted implementation to avoid needing to do this extra work. The button *looks* highlighted, so we don't have to change the text color. - On the reference platform, when disabled, text is grey by default, UNLESS any custom normal or disabled text colors are set. On our platform, we DEFAULT to disabled to grey text and then you can change it, but changing the normal color won't affect the default color (for the sake of simplicity). Scrubbed Annotations: All UIButton annotations have been scrubbed and updated with 'NotInPlan' status as needed. Fixes microsoft#1442 Fixes microsoft#1885 Fixes microsoft#1671 Fixes microsoft#1671 Fixes VSO 10145069. Fixes VSO 9533114.
- Loading branch information