首页 \ 问答 \ 使用UISegmentedControl的导航控制器中的自动布局:在iOS7中很好,在iOS6中很糟糕(Auto Layout in Navigation Controller with UISegmentedControl: good in iOS7, bad in iOS6)

使用UISegmentedControl的导航控制器中的自动布局:在iOS7中很好,在iOS6中很糟糕(Auto Layout in Navigation Controller with UISegmentedControl: good in iOS7, bad in iOS6)

对于导航控制器,我喜欢在从顶部到底部的视图中放置一些控件。 我正在使用自动布局和添加约束,以便视图彼此之间存在垂直间隙。 对于普通视图控制器中的iOS7和iOS6,这在导航控制器中也适用于iOS7; 但在iOS6中出错了。 UISegmentedControl显示错误。 查看截图。

看起来iOS6视图中没有考虑UISegmentedControl的较大高度。 当从3.5英寸屏幕切换到4英寸屏幕时,它也会移位。

请注意,这仅发生在导航控制器视图中。 在导航控制器的故事板中,我将Top Bar设置为“Opaque Navigation Bar”。 上部按钮具有约束“顶部空间到顶部布局指南”。 所有其他控件都有一个约束“Top Space to ....”(控制在它们上面)。

我可以申请任何已知的修复程序吗?

可能有什么不对? (我是汽车布局的新手。)或者它只是一个我必须以某种方式解决的错误?


编辑:

我尝试将分段控件放在一个额外的视图中,但这也无济于事。

我可以为分段控件设置高度约束,这在某种程度上有所帮助。 但是对于分段控件,这为iOS6和iOS7设置了相同的高度。 我现在的工作是在视图加载时更改/添加代码中的高度约束,并根据iOS版本设置值。 还有其他建议吗?


截图:

在Navigation Controller中,iOS6视图:

在iOS6-View中移动布局

在Navigation Controller中,iOS7视图:

iOS7中的漂亮布局


在“普通”视图控制器中,iOS6视图:

iOS6视图中的漂亮布局

在“普通”视图控制器中,iOS7视图:

iOS7中的漂亮布局


For a navigation controller I like to have a few controls placed in a view from top towards the bottom. I am using auto layout and added constraints, so that the views have a vertical gap to each other. This looks nice for iOS7 and iOS6 in a normal view controller, also for iOS7 in a navigation controller; but wrong in iOS6. The UISegmentedControl shows up wrong. See the screenshots.

It looks like the larger height of the UISegmentedControl is not taken into account for iOS6 view. Also it gets shifted out of place when switching from 3.5 inch to 4 inch screen.

Note that this only occurs in a navigation controller view. In the storyboard for the navigation controller I set Top Bar to "Opaque Navigation Bar". The upper button has a constraint "Top Space to Top Layout Guide". All other controls have a constraint "Top Space to ...." (control above them).

Are there any known fixes which I could apply?

What could be wrong? (I'm quite a newbie for auto layout.) Or is it just a bug which I have to work around somehow?


EDIT:

I tried placing the segmented control in an extra view, but that did not help either.

I could set a height constraint to the segmented control and that did help in a way. But this sets the same height to both iOS6 and iOS7 for the segmented control. My work around would now be to change/add the height constraint in code when the view loads and set a value depending on the iOS version. Are there other recommendations?


The screenshots:

In Navigation Controller, iOS6 view:

Shifted Layout in iOS6-View

In Navigation Controller, iOS7 view:

Nice Layout in iOS7


In a "normal" view controller, iOS6 view:

Nice Layout in iOS6-View

In a "normal" view controller, iOS7 view:

Nice Layout in iOS7


原文:
更新时间:2022-10-03 06:10

最满意答案

当您使用::ffff:映射地址时,您实际上是在软件中使用IPv6套接字时通过网络发送IPv4数据包。 它使得更容易支持这两种协议,但它不允许您混合使用不同的地址族。

网络上的数据包是IPv4数据包(具有IPv4源和目标地址)或IPv6数据包(具有IPv6源和目标地址)。 ::ffff:地址永远不会在实际数据包中使用。 它仅作为软件表示存在。

如果您使用IPv6套接字与::ffff:地址进行通信,那么在线::ffff:它们将是纯IPv4数据包,并且您的本地IPv4地址将用于您的连接。


When you use the ::ffff: mapped addresses then you are actually sending IPv4 packets across the network while using IPv6 sockets in software. It makes it easier to support both protocols, but it doesn't allow you to mix the different address families.

The packet on the network is either an IPv4 packet (with IPv4 source and destination addresses) or an IPv6 packet (with IPv6 source and destination addresses). The ::ffff: address will never be used in an actual packet. It only exists as a software representation.

If you use IPv6 sockets to communicate with ::ffff: addresses then on the wire they will be plain IPv4 packets, and your local IPv4 address will be used on your side of the connection.

相关问答

更多
  • 你可以使用host ='fe80 :: ba27:ebff:fed4:5691',假设你只有一个链接。 链路本地地址(链路本地范围)旨在用于在单个链路上进行寻址,以用于诸如自动地址配置,邻居发现或不存在路由器之类的目的。 路由器不得将具有链路本地源或目标地址的任何数据包转发到其他链路。 因此,如果要将数据从服务器发送到raspberry pi(1链接),则可以使用链接本地范围作为IPv6地址。 host ='ff02 :: 1:ffd4:5691'是链路本地多播作用域,除非你有理由发送多播,否则没有必要。 ...
  • 最好的方法是创建一个可以接受IPv4连接的IPv6服务器套接字。 为此,创建一个常规的IPv6套接字, 关闭套接字选项IPV6_V6ONLY ,将其绑定到“任何”地址,然后开始接收。 IPv4地址将以IPv4映射格式显示为IPv6地址。 系统的主要区别是IPV6_V6ONLY是否可用,b)默认情况下打开或关闭。 在Linux上默认关闭(即允许没有setsockopt的双栈套接字),并在大多数其他系统上打开。 此外,Windows XP上的IPv6堆栈不支持该选项。 在这种情况下,您将需要创建两个单独的服务器 ...
  • string strHostName = System.Net.Dns.GetHostName();; IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName); IPAddress[] addr = ipEntry.AddressList; Console.WriteLine(addr[addr.Length-1].ToString()); if (addr[0].AddressFamily == System.Net.Sockets.A ...
  • 这是一个python mcast演示的链接,可以兼容IPv4和IPv6。 Here's a link to python mcast demo, does both IPv4 and IPv6.
  • 如果你想确保没有发生IPv6连接,可以将Listen 0.0.0.0:80添加到你的apache配置中。 但是大多数网络主机仍然不支持IPv6(我知道,我们在2011年),所以人们甚至不可能通过IPv6连接到您。 你看到这个的唯一原因是因为bonjour(什么使得.local地址工作)在IPv6上运行。 如果你想让你的代码准备好IPv6,几乎不需要做任何更改,因为大多数IP PHP功能都可以在IPv4和IPv6上使用。 我记得的唯一改变是将MySQL表中的varchar数据类型增加到IPv6地址的最大长度( ...
  • 当您使用localhost ,它将使用TCP连接,通过系统中配置的任何内容来响应localhost 。 在Linux上,它通常映射在/etc/hosts ,通常是IPv4 127.0.0.1或IPv6 ::1 (因为它可能是你的情况)。 现在,如果您想在本地连接,您可以选择: postgresql://vaderade@localhost:5432/mydb :通过TCP localhost连接(如果IPv4或IPv6依赖于您的系统) postgresql://vaderade@127.0.0.1:5432 ...
  • 没有标准的可移植接口将单个套接字绑定到未指定的地址,并将范围限制为特定接口上的地址,更不用说同时选择性地要求强主机模型与该套接字进行通信。 支持此功能的每个操作系统都会采用不同的方式。 There is no standard portable interface for binding a single socket to the unspecified address and limiting the scope to the addresses on a specific interface, muc ...
  • 从get_current_address_and_port删除此行。 sockaddr.sa_family = AF_INET6; 我不知道如何将这一行写入您的代码,但这是不正确的。 通过删除该行,这将清除IPv4的大部分问题。 您的代码是硬连线使用struct sockaddr 。 无论如何,IIRC,sockaddr对于IPv6地址来说还不够大。 我建议将其转换为sockaddr_storage以初始调用getsockname和getpeername以便您的代码可以更好地用于IPv4和IPv6 ...
  • 感谢@ugoren十六进制转储技术(在评论中),我能够弄清楚IPv6结构本身包含一个0.0.0.1地址。 我意识到问题可能是由于不同的JDK。 Java项目是使用OpenJDK 7构建的,而我使用的PC有OpenJDK 6.当我将JDK更新到版本7时,错误消失了。 但是,它让我遇到了另一个错误,这个错误记录在一个新的stackoverflow问题上 ,我仍然无法解决。 Thanks to @ugoren hex dump technique (in comments), I was able to figu ...
  • 当您使用::ffff:映射地址时,您实际上是在软件中使用IPv6套接字时通过网络发送IPv4数据包。 它使得更容易支持这两种协议,但它不允许您混合使用不同的地址族。 网络上的数据包是IPv4数据包(具有IPv4源和目标地址)或IPv6数据包(具有IPv6源和目标地址)。 ::ffff:地址永远不会在实际数据包中使用。 它仅作为软件表示存在。 如果您使用IPv6套接字与::ffff:地址进行通信,那么在线::ffff:它们将是纯IPv4数据包,并且您的本地IPv4地址将用于您的连接。 When you use ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)