Skip to content
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

fix(ios): update tabbar after trait colection changed #11200

Merged
merged 2 commits into from
Sep 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions iphone/Classes/TiUITabProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ @implementation TiUITabProxy

- (void)_destroy
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiTraitCollectionChanged object:nil];

if (rootWindow != nil) {
[self cleanNavStack:YES];
}
Expand All @@ -54,9 +56,18 @@ - (void)_configure
[self replaceValue:NUMBOOL(YES) forKey:@"activeIconIsMask" notification:NO];
[self replaceValue:nil forKey:@"titleColor" notification:NO];
[self replaceValue:nil forKey:@"activeTitleColor" notification:NO];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didChangeTraitCollection:)
name:kTiTraitCollectionChanged
object:nil];
[super _configure];
}

- (void)didChangeTraitCollection:(NSNotification *)info
{
[self updateTabBarItem];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the UIImage instances use semantic images already and check automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay. But traitCollectionDidChange: fires for iOS 8+ and also if the device is rotated or font scaling is updated. It's minor but should be guarded in a later release to prevent unnecessary UI work.

}

- (NSString *)apiName
{
return @"Ti.UI.Tab";
Expand Down