- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
就像这个问题:Auto Layout and in-call status bar和这个问题:Resize for in-call status bar?一样,我在“通话中状态栏”出现问题时搞砸了我的 View 布局。
这是我的嵌套结构。我有一个嵌套在另一个ViewController中的自定义模态ViewController。每当显示“通话中状态栏”(然后关闭)时,就会发生这种情况:
这是显示“呼入状态”栏之前的外观的图片:
发生错误后状态栏的背景蓝色是根 View Controller 的背景颜色。
每当显示“呼入状态”栏时,都会打印出以下错误:
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7fdac6192320 V:|-(20)-[UIInputSetContainerView:0x7fdac6190a40] (Names: '|':UITextEffectsWindow:0x7fdac6061a10 )>",
"<NSLayoutConstraint:0x7fdac608ebb0 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x7fdac6190a40] (Names: '|':UITextEffectsWindow:0x7fdac6061a10 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fdac6192320 V:|-(20)-[UIInputSetContainerView:0x7fdac6190a40] (Names: '|':UITextEffectsWindow:0x7fdac6061a10 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7fc60b03d230 V:|-(20)-[UIInputSetContainerView:0x7fc608d22020] (Names: '|':UITextEffectsWindow:0x7fc60b171720 )>",
"<NSLayoutConstraint:0x7fc60b03d2d0 UIInputSetContainerView:0x7fc608d22020.bottom == UITextEffectsWindow:0x7fc60b171720.bottom>",
"<NSLayoutConstraint:0x7fc60b17c4b0 'UIInputWindowController-height' UIInputSetContainerView:0x7fc608d22020.height == UITextEffectsWindow:0x7fc60b171720.height>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fc60b03d2d0 UIInputSetContainerView:0x7fc608d22020.bottom == UITextEffectsWindow:0x7fc60b171720.bottom>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
UINavigationBarBackground
和
UIStatusBarForegroundView
重叠,但是之后
UINavigationBarBackground
在
UIStatusBarForegroundView
以下。
最佳答案
iOS 9.2.1,Xcode 7.2.1,启用ARC的
更新2016年3月25日:冲突在Xcode 7.3,iOS 9.3中仍然存在。
摘要:在您的应用程序的窗口层次结构中,有各种窗口被添加到应用程序窗口中。在我的情况下,这是UITextEffectsWindow
和UIRemoteKeyboardWindow
。这些窗口带有预配置的约束。似乎有一个错误会更新某些垂直布局约束,但不会更新同一窗口的其他相关约束。这在调试器中引发约束冲突。在模拟器和实际的iOS设备上,当自定义窗口被添加到窗口层次结构中或调用状态栏被切换为进出时,就会发生这种情况。
约束的优先级为1000,这表示它们是必需的约束。
下面的解决方案将删除冲突的约束,并在拨入调用状态栏后将其重新添加。
编辑2016年2月25日:两种解决方案都无法解决打开应用程序时已显示通话状态栏的问题。在注册状态栏更改之前发生冲突。
似乎这种约束冲突仅在首次显示调用中状态栏时才发生(这是最常见的),或者在其他情况下(涉及位于键窗口顶部的其他自定义窗口的呈现)发生。 我也尝试仅创建一个空白的单 View 应用程序,并且在通话中状态栏中未添加任何切换,并且遇到了相同的约束冲突。
我认为这是一个错误,将在开发论坛中进行讨论。 Dev论坛的原始文章可以在这里找到(如matty指出的那样):
https://forums.developer.apple.com/thread/16375
我想对matty's answer here进行扩展。我发现这很有帮助。我不确定删除“所有”约束会产生什么影响,因此我仅删除了冲突的约束。我的理由是,当调试器通知“将尝试通过打破约束进行恢复”时,无论如何冲突的约束都会被打破;因此,约束将毫无用处。
这是我收到的约束冲突错误:
解释了约束错误之后(请参阅此Apple文档以帮助解决此问题:https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/DebuggingTricksandTips.html),我使用以下代码摆脱了冲突的约束:
目标-C:
* AppDelegate.h
...
@interface YourAppName : UIResponder <UIApplicationDelegate>
{
NSMutableDictionary *dictionaryConstraints;
}
...
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
dictionaryConstraints = [[NSMutableDictionary alloc] init];
return true;
}
- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame
{
NSLog(@"newStatusBarFrame: %@", NSStringFromCGRect(newStatusBarFrame));
if (newStatusBarFrame.size.height > 20.0)
{
for (UIWindow *window in [[UIApplication sharedApplication] windows])
{
if ([window.class.description isEqual:@"UITextEffectsWindow"] || [window.class.description isEqual:@"UIRemoteKeyboardWindow"])
{
NSMutableArray *constraints = [[NSMutableArray alloc] initWithCapacity:[window.constraints count]];
for (NSLayoutConstraint *constraint in window.constraints)
{
if (!([constraint.description rangeOfString:@"V:|-(0)-[UIInputSetContainerView"].location == NSNotFound))
{
NSLog(@"");
NSLog(@"%@: %@, %f, %f", window.class.description, constraint.description, constraint.priority, constraint.constant);
NSLog(@"");
[constraints addObject:constraint];
[window removeConstraint:constraint];
}
else
{
nil;
}
}
if ([constraints count] > 0)
{
[dictionaryConstraints setObject:constraints forKey:[NSString stringWithFormat:@"%p", window]];
}
else
{
nil;
}
}
else
{
nil;
}
}
}
else
{
nil;
}
}
- (void)resetConstraints
{
for (UIWindow *window in [[UIApplication sharedApplication] windows])
{
if ([window.class.description isEqual:@"UITextEffectsWindow"] || [window.class.description isEqual:@"UIRemoteKeyboardWindow"])
{
if (dictionaryConstraints)
{
NSArray *keys = [dictionaryConstraints allKeys];
for (int i = 0; i < [keys count]; i++)
{
if ([[NSString stringWithFormat:@"%p", window] isEqualToString:keys[i]])
{
[window addConstraints:[dictionaryConstraints objectForKey:keys[i]]];
}
else
{
nil;
}
}
}
else
{
nil;
}
}
else
{
nil;
}
}
}
- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame
{
NSLog(@"oldStatusBarFrame: %@", NSStringFromCGRect(oldStatusBarFrame));
if (oldStatusBarFrame.size.height > 20.0)
{
if ([dictionaryConstraints count] > 0)
{
[self resetConstraints];
[dictionaryConstraints removeAllObjects];
}
else
{
nil;
}
}
else
{
nil;
}
for (UIWindow *window in [[UIApplication sharedApplication] windows])
{
if ([window.class.description isEqual:@"UITextEffectsWindow"] || [window.class.description isEqual:@"UIRemoteKeyboardWindow"])
{
for (NSLayoutConstraint *constraint in window.constraints)
{
if (!([constraint.description rangeOfString:@"V:|-(0)-[UIInputSetContainerView"].location == NSNotFound))
{
NSLog(@"");
NSLog(@"%@: %@, %f, %f", window.class.description, constraint.description, constraint.priority, constraint.constant);
NSLog(@"");
}
else
{
nil;
}
}
}
else
{
nil;
}
}
}
...
...
var dictionaryConstraints = [NSString : NSArray]();
...
func application(application: UIApplication, willChangeStatusBarFrame newStatusBarFrame: CGRect)
{
print("newStatusBarFrame: \(newStatusBarFrame)")
if newStatusBarFrame.size.height > 20.0
{
for window in UIApplication.sharedApplication().windows
{
if ((window.classForCoder.description() == "UITextEffectsWindow") || (window.classForCoder.description() == "UIRemoteKeyboardWindow"))
{
var constraints = [NSLayoutConstraint]()
for constraint in window.constraints
{
if (constraint.description.containsString("V:|-(0)-[UIInputSetContainerView"))
{
print("\(window.classForCoder.debugDescription), \(constraint.description), \(constraint.priority), \(constraint.constant)")
constraints.append(constraint)
window.removeConstraint(constraint)
}
else
{
//nil
}
}
if (constraints.count > 0)
{
dictionaryConstraints[NSString(format: "%p", unsafeAddressOf(window))] = constraints
}
else
{
//nil
}
}
else
{
//nil
}
}
}
else
{
//nil
}
}
func resetConstraints()
{
for window in UIApplication.sharedApplication().windows
{
if ((window.classForCoder.description() == "UITextEffectsWindow") || (window.classForCoder.description() == "UIRemoteKeyboardWindow"))
{
if (dictionaryConstraints.count > 0)
{
let keys = Array(dictionaryConstraints.keys)
for i in 0 ..< keys.count
{
if (NSString(format: "%p", unsafeAddressOf(window)) == keys[i])
{
window.addConstraints(dictionaryConstraints[keys[i]] as! [NSLayoutConstraint])
}
else
{
//nil
}
}
}
else
{
//nil
}
}
else
{
//nil
}
}
}
func application(application: UIApplication, didChangeStatusBarFrame oldStatusBarFrame: CGRect)
{
print("oldStatusBarFrame: \(oldStatusBarFrame)")
if (oldStatusBarFrame.size.height > 20.0)
{
if (dictionaryConstraints.count > 0)
{
self.resetConstraints()
dictionaryConstraints.removeAll()
}
else
{
//nil
}
}
else
{
//nil
}
for window in UIApplication.sharedApplication().windows
{
if ((window.classForCoder.description() == "UITextEffectsWindow") || (window.classForCoder.description() == "UIRemoteKeyboardWindow"))
{
for constraint in window.constraints
{
if (constraint.description.containsString("V:|-(0)-[UIInputSetContainerView"))
{
print("\(window.classForCoder.debugDescription), \(constraint.description), \(constraint.priority), \(constraint.constant)")
}
else
{
//nil
}
}
}
else
{
//nil
}
}
}
...
...
- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame
{
NSLog(@"New status bar frame: %@", NSStringFromCGRect(newStatusBarFrame));
for (UIWindow *window in [[UIApplication sharedApplication] windows])
{
NSLog(@"%@, %@", window.description, window.constraints);
}
}
- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame
{
NSLog(@"Old status bar frame: %@", NSStringFromCGRect(oldStatusBarFrame));
for (UIWindow *window in [[UIApplication sharedApplication] windows])
{
NSLog(@"%@, %@", window.description, window.constraints);
}
}
...
< UITextEffectsWindow: 0x7fbf994cc810; frame = (0 0; 320 568); opaque = NO; autoresize = W+H; layer = < UIWindowLayer: 0x7fbf994c8470> >,
( "< NSLayoutConstraint:0x7fbf99667eb0 V:|-(0)-[UIInputSetContainerView:0x7fbf99668ce0] (Names: '|':UITextEffectsWindow:0x7fbf994cc810 )>",
...omitted
"< NSLayoutConstraint:0x7fbf9966c800 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x7fbf99668ce0] (Names: '|':UITextEffectsWindow:0x7fbf994cc810 ) >",
...omitted )
< UIRemoteKeyboardWindow: 0x7fbf994ceb80; frame = (0 0; 320 568); opaque = NO; autoresize = W+H; layer = < UIWindowLayer: 0x7fbf994cf190> >,
( "< NSLayoutConstraint:0x7fbf994cfb20 V:|-(0)-[UIInputSetContainerView:0x7fbf99744ec0] (Names: '|':UIRemoteKeyboardWindow:0x7fbf994ceb80 ) >",
...omitted
"< NSLayoutConstraint:0x7fbf9966c800 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x7fbf99668ce0] (Names: '|':UITextEffectsWindow:0x7fbf994cc810 )>",
...omitted )
< UITextEffectsWindow: 0x7fbf994cc810; frame = (0 0; 320 568); opaque = NO; autoresize = W+H; layer = < UIWindowLayer: 0x7fbf994c8470> >,
( "< NSLayoutConstraint:0x7fbf99667eb0 V:|-(20)-[UIInputSetContainerView:0x7fbf99668ce0] (Names: '|':UITextEffectsWindow:0x7fbf994cc810 )>",
...omitted
"< NSLayoutConstraint:0x7fbf9966c800 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x7fbf99668ce0] (Names: '|':UITextEffectsWindow:0x7fbf994cc810 ) >",
...omitted )
< UIRemoteKeyboardWindow: 0x7fbf994ceb80; frame = (0 0; 320 568); opaque = NO; autoresize = W+H; layer = < UIWindowLayer: 0x7fbf994cf190> >,
( "< NSLayoutConstraint:0x7fbf994cfb20 V:|-(20)-[UIInputSetContainerView:0x7fbf99744ec0] (Names: '|':UIRemoteKeyboardWindow:0x7fbf994ceb80 ) >",
...omitted
"< NSLayoutConstraint:0x7fbf9966c800 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x7fbf99668ce0] (Names: '|':UITextEffectsWindow:0x7fbf994cc810 )>",
...omitted )
NSLayoutConstraint:0x7fbf99667eb0 V:|-(0)-[UIInputSetContainerView:0x7fbf99668ce0]
NSLayoutConstraint:0x7fbf99667eb0 V:|-(20)-[UIInputSetContainerView:0x7fbf99668ce0]
NSLayoutConstraint:0x7fbf9966c800 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x7fbf99668ce0]
关于ios - 在通话状态栏中(无法满足约束条件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33112762/
我正在为大约 80 位用户开发 Word VBA 宏应用程序。办公室人员流动率高,因此培训受到影响,因此该项目的 self 强加要求之一是全面、友好的文档。然而,为了补充这一点,并且为了避免新手在尝试
我想在我的应用程序中隐藏状态栏 (Syste UI),并且我想始终显示导航栏。从 android 开发人员文档中,我得到了这个代码来获得全屏。 int uiOptions = View.SYSTEM_
我正在尝试将 splitview Controller 添加为 subview Controller 。父 View Controller 是导航 Controller 。父 View Control
是否可以隐藏括号中的底部面板?左侧有行和列,右侧有可能的错误消息、语言和一些其他详细信息。 我真的很喜欢 Brackets 代码编辑器,但不幸的是我必须在相当小的屏幕上工作,并且底部面板浪费了宝贵的空
我有一个类似于照片应用程序的应用程序,当显示图片时,它会占据整个 320x480 的屏幕。也像照片应用一样,当用户点击屏幕时,状态栏/导航栏会淡出以提供额外的空间。一切正常,除了我注意到一个奇怪的故障
有人知道如何在新 Facebook 中找到状态栏的好教程吗?底部的那个。看起来真的很酷 我以为它是用 ajax 或 jquery 编写的。但不确定。 最佳答案 以下是一些可能对您有帮助的有用链接/插件
我有一个 php 脚本,我试图将状态类型汇总到变量中。例如,当我执行以下操作时: echo $val['status']; 我得到: New New New Dead In Process New N
这个问题在这里已经有了答案: How to change Status Bar text color in iOS (59 个答案) 关闭 7 年前。 我尝试更改 IOS 应用程序的样式。使用以下方
我正在将我的 searchController 添加到我当前的 Controller ,当我使用 xcode 5.1.1 时它工作正常,但是当我升级到 xcode 6 时,它给我带来了问题。我注意到它
有没有一种方法可以像在 Windows 应用程序中那样在 SWT 中创建原生状态栏: 我见过使用标签模拟的状态栏,但我对真正的解决方案更感兴趣。 最佳答案 org.eclipse.jface.acti
有一个包含一些数字列的网格,需要为每个列实现一个聚合(总和或计数)并将其显示在相应的列下。 我知道一些套件(DevExpress 或其他)已经“默认”实现。但是有办法使用默认控件或 JVCL 来实现吗
我比较陌生,所以我不知道为什么我的应用栏看起来像这样 这是main.dart文件 import 'package:testapp/test_page.dart'; import 'package:fl
我已经设置了线条、矩形和椭圆形,但我有一个问题。 如何使我的线条、椭圆形和矩形在 main 方法中可见?由于某种原因,当我编译和运行文件时它们没有被输出......谢谢 import java.aw
我想在闪屏中隐藏状态栏并显示给 viewController与白色。 我为此做了以下工作: 在 YES 中添加了“状态栏最初是隐藏的”在 info.plist . 在 –(BOOL)applicati
我想为我的用户实现一种关于进度状态的信息。我发现了几个组件,例如: Richfaces status或 IceFaces onnection Status 所以,我想在我的页面中添加类似的东西,特别是
我有一个弹出窗口,弹出窗口内部是一个相机按钮,我的相机工作正常,但顶部的电池符号与相机重叠,下面是屏幕截图。 如果有人知道答案,我们将不胜感激。 最佳答案 您可以隐藏该 View 的状态栏,这样它就不
所以我现在有一个 ExecutorService 成功地阻塞并线性运行。我的麻烦是,我正在尝试添加状态更新,但我不知道如何让 Futures 一次结算一个项目。似乎当我的 Future<> 中的第一项
纽约时报 Android 应用程序在顶部有一个类似于通知栏的东西。 我怀疑这是一个包含 TextView 的布局。问题是他们设法将标题拖下以显示头条新闻。 任何人都可以提供有关如何复制它的任何见解吗?
我这辈子都不知道如何去掉应用程序顶部的白条。 http://cl.ly/image/3Z2I1x0H3H17 我目前使用导航 Controller 作为 Root View 。我也尝试过将 UIVie
我有一个我想全屏的应用程序,但我尝试过的每个解决方案,状态栏都是白色的,并且应用程序没有全屏运行。 如何隐藏状态栏? 最佳答案 从 2016 年开始唯一正确的解决方案: 在您的应用程序 plist 文
我是一名优秀的程序员,十分优秀!