Skip to content

Commit

Permalink
Updates MDCMultilineTextField to better support being embedded in sel…
Browse files Browse the repository at this point in the history
…f-sizing cells.

PiperOrigin-RevId: 318269826
  • Loading branch information
Nobody authored and material-automation committed Jun 25, 2020
1 parent e214be3 commit b3a632d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/TextFields/src/MDCMultilineTextField.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
*/
@property(nonatomic, nullable, strong) IBOutlet MDCIntrinsicHeightTextView *textView;

/**
* Whether or not the multiline text field should use its contraints to calculate its intrinsic
* content size. Default is NO, in which case the multiline text field gives an approximate
* intrinsic content size using its subviews.
*/
@property(nonatomic) BOOL useConstraintsForIntrinsicContentSize;

/**
A block that is invoked when the @c MDCMultilineTextField receives a call to @c
traitCollectionDidChange:. The block is called after the call to the superclass.
Expand Down
3 changes: 3 additions & 0 deletions components/TextFields/src/MDCMultilineTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ - (void)setupUnderlineConstraints {
#pragma mark - Layout (UIView)

- (CGSize)intrinsicContentSize {
if (self.useConstraintsForIntrinsicContentSize) {
return [super intrinsicContentSize];
}
CGSize boundingSize = CGSizeZero;
boundingSize.width = UIViewNoIntrinsicMetric;

Expand Down

0 comments on commit b3a632d

Please sign in to comment.