-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jwoo/toggle view update #4204
Jwoo/toggle view update #4204
Conversation
@golddove is added to the review. #Closed |
@@ -37,38 +38,47 @@ - (UIView *)render:(UIView<ACRIContentHoldingView> *)viewGroup | |||
{ | |||
std::shared_ptr<HostConfig> config = [acoConfig getHostConfig]; | |||
std::shared_ptr<BaseCardElement> elem = [acoElem element]; | |||
std::shared_ptr<ToggleInput> toggleBlck = std::dynamic_pointer_cast<ToggleInput>(elem); | |||
std::shared_ptr<ToggleInput> adaptiveToggleInput = std::dynamic_pointer_cast<ToggleInput>(elem); | |||
|
|||
NSBundle *bundle = [NSBundle bundleWithIdentifier:@"MSFT.AdaptiveCards"]; | |||
if (!bundle) { // https://github.com/Microsoft/AdaptiveCards/issues/1834 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft [](start = 41, length = 9)
Nit: This looks to be a TODO; In that case, can you update teh comment to be more explicit following a "TODO: [Link to the tracking issue] Log warnings and errors"
toggleView.title.textColor = getForegroundUIColorFromAdaptiveAttribute(config, viewGroup.style); | ||
toggleView.title.adjustsFontSizeToFitWidth = NO; | ||
if (!adaptiveToggleInput->GetWrap()) { | ||
toggleView.title.numberOfLines = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1; [](start = 41, length = 2)
In general for code readability avoid hardcoded literals and magic numbers; Trying to understand the logic here - So if wrap property isnt specified we interpret/default to 1 for its title line count? This almost feels like an initialization operation that say can be handled at the constructor for ACRToggleInputView no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS renderer defaults number of lines to zero. If zero, text box will keep increasing its height with longer text. iOS renderer limits number of lines to 1, and its effect is same as having wrap property set to "false".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* fixed the crash when there is no image is provided * Updated Toggle Input to respond better to superview's width * updated default value of toggle switch Co-authored-by: shalinijoshi19 <shalinij@microsoft.com>
* fixed the crash when there is no image is provided * Updated Toggle Input to respond better to superview's width * updated default value of toggle switch Co-authored-by: shalinijoshi19 <shalinij@microsoft.com>
Related Issue
Fixed #4052, Fixed #3978
Description
#4052 mentioned that "stretch" and "auto" did not work very well when Input.Toggle is the only item of Column. This is an expected behavior since the input toggle is implemented using UITableView, and label space provided by UITableView has strong compression resistance. However, using UITableView as a superview for Input.Toggle is too heavy since UITableView has functions that can't be utilized in Input.Toggle. Implemented Input.Toggle as a XIB instance that allows easier customization of Input.Toggle, and used simpler UI inside the XIB.
How Verified
How you verified the fix, including one or all of the following:
AFTER
BEFORE

Microsoft Reviewers: Open in CodeFlow