我在我的视图顶部有一个UICollectionView,还有一个ListView,当我点击ListView的一个项目时,它打开一个新的控制器,顶部和底部有两个(隐藏/未隐藏)栏,全屏带有Carousel的WebView.我正常使用水龙头或滑动,但在关闭我的新视图后(我在顶部栏中有一个X)它会显示上一个视图但突然收集大小的高度较小.¿我该如何防止这种情况?
我一直在寻找周围,这就像同样的问题,这可是我的问题没有导航栏的区别,是导航栏下方的集合.
我已经花了好几个小时,我需要有人指点我.
编辑 - 更新
我在我的第一个视图中有一个ListView,一个
[[NSNotificationCenter defaultCenter] postNotificationName: showFooMode....
我在另一个视图中有一个观察者,它是我整个应用程序的常见视图,因为它左边有菜单,它改变了右边的数据:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showfooMode:) name:@"showFooMode" object:nil];
Run Code Online (Sandbox Code Playgroud)
和选择方法....
-(void)showfooMode:(NSNotification *)notification{
NSLog(@"Show fooView in the GeneralView);
FooItem *foo = [notification.object objectForKey:@"foo"];
NSInteger currentIndex = [[notification.object objectForKey:@"foo"] integerValue];
auxFooView = [notification.object objectForKey:@"delegate"];
// currentIndex = 20;
fooView = [self.storyboard instantiateViewControllerWithIdentifier:@"fooView"];
[fooView setNews:news];
[fooView setDelegate:self];
[fooView setCurrentIndex:currentIndex];
fooView.view.alpha = 0;
[self.view addSubview: magazineVC.view];
[self addChildViewController:fooView];
fooView.view.translatesAutoresizingMaskIntoConstraints = NO;
NSDictionary *views = @{@"childview": fooView.view};
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-0-[childview]-0-|" options:0 metrics:nil views:views]]; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下代码在我的设备中获取正确的语言(不在模拟器中):
NSString * languageLocale = [[NSLocale preferredLanguages] objectAtIndex:0];
Run Code Online (Sandbox Code Playgroud)
它总是“en”, 但我当前的语言设置为西班牙语
有什么想法为什么检索总是“en”而不是当前的设备语言?
我一直在寻找,如果我这样做,我是否需要做同步:
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kType];
Run Code Online (Sandbox Code Playgroud)
那之后,我该怎么办?:
[[NSUserDefaults standardUserDefaults] synchronize];
Run Code Online (Sandbox Code Playgroud)
在这件事上等你的答案.