/* Copyright 2024 New Vector Ltd. Copyright 2017 Vector Creations Ltd Copyright 2016 OpenMarket Ltd SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ #import "SimpleRoomTitleView.h" #import "ThemeService.h" @implementation SimpleRoomTitleView + (UINib *)nib { return [UINib nibWithNibName:NSStringFromClass([SimpleRoomTitleView class]) bundle:[NSBundle bundleForClass:[SimpleRoomTitleView class]]]; } - (void)awakeFromNib { [super awakeFromNib]; } - (void)layoutSubviews { [super layoutSubviews]; if (self.superview) { // Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance. NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.superview attribute:NSLayoutAttributeTop multiplier:1.0f constant:0.0f]; NSLayoutConstraint *centerXConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.superview attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]; [NSLayoutConstraint activateConstraints:@[topConstraint, centerXConstraint]]; } } @end