Skip to content

Commit

Permalink
Automatically adjust message font size dynamically when user change t…
Browse files Browse the repository at this point in the history
…he setting
  • Loading branch information
Nicolas Buquet committed Oct 24, 2023
1 parent a6ecbac commit d0a506a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Riot/Modules/Common/SectionHeaders/TabListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class TabListView: UIView {
for (index, item) in items.enumerated() {
let button = UIButton(type: .system)
button.titleLabel?.font = itemFont
// Tchap: automatically adjust button font size dynamically when user change the setting.
button.vc_adjustsFontForContentSizeCategory = true
button.setTitle(item.text, for: .normal)
button.setImage(item.icon?.withRenderingMode(.alwaysTemplate), for: .normal)
button.contentEdgeInsets = UIEdgeInsets(top: 0, left: Constants.itemSpacing / 2, bottom: 0, right: Constants.itemSpacing / 2)
Expand Down
23 changes: 23 additions & 0 deletions Riot/Modules/MatrixKit/Views/MXKMessageTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@ @interface MXKMessageTextView()

@implementation MXKMessageTextView

// Tchap: automatically adjust message font size dynamically when user change the setting.
- (id)initWithFrame:(CGRect)frame textContainer:(NSTextContainer *)textContainer
{
self = [super initWithFrame:frame textContainer:textContainer];

if (self) {
[self setAdjustsFontForContentSizeCategory:YES];
}

return self;
}

// Tchap: automatically adjust message font size dynamically when user change the setting.
- (id)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];

if (self) {
[self setAdjustsFontForContentSizeCategory:YES];
}

return self;
}

- (BOOL)canBecomeFirstResponder
{
return NO;
Expand Down

0 comments on commit d0a506a

Please sign in to comment.