【发布时间】:2015-10-16 15:35:57
【问题描述】:
在我的应用程序中,我有一个 TabBar 和一个 ViewController,它们通过使用 DelegateProtocol 以模态方式呈现。虽然一切都按预期工作,但我收到了一个奇怪的错误。当我关闭我的模态 ViewController 时,TabBarItems 的标签比以前大。之后即使调整大小也不起作用。
我正在像这样解雇我的模态 ViewController:
-(void)universalLoginFinished:(UniversalLoginModalViewController *)viewController {
NSLog(@"Login successful");
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
appDelegate.isLoggedIn = YES;
[self dismissViewControllerAnimated:YES completion:^{
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"MerriweatherSans-Regular" size:18.0f], NSFontAttributeName, nil] forState:UIControlStateNormal];
self.tabBarController.tabBar.translucent = NO;
[self.tabBarController.tabBar setTintColor:UIColorFromRGB(0x0077B3)];
[self viewDidLoad];
}];
}
编辑
调用和关闭模态视图之前的我的 TabBar
调用和关闭模态视图后的我的 TabBar
我是否忘记了导致我的 TabBarItems 的标签变大的东西,还是我做错了什么?
【问题讨论】:
-
可以添加截图吗?还请解释你为什么从一个方法调用 viewdidload ?
-
我马上添加截图。在关闭模态视图后,我调用它来重新加载我的视图。 [self.view setNeedsDisplay] 不适合我。
-
18号字体?也是以前的字体吗?
-
是的,我只使用 18.0f 作为商品标签的尺寸。
-
试着把它变成 9 看看,它的标签仍然扩大。我确定,这和大小有关!!!
标签: ios objective-c