Layout Support 获取上下bar的长度

Layout Support

This protocol is implemented by the UIViewController properties topLayoutGuide and bottomLayoutGuide to support using Auto Layout with a view controller’s view, starting in iOS 7. You can use layout guides as layout items in the NSLayoutConstraint factory methods.

Layout Support
length
Provides the length, in points, of the portion of a view controller’s view that is overlaid by translucent or transparent UIKit bars. (required)

Declaration
SWIFT
var length: CGFloat { get }
OBJECTIVE-C
@property(nonatomic, readonly) CGFloat length
Discussion
In iOS 7 and later, a view controller’s view occupies the full height of the screen when there are no opaque UIKit bars (such as opaque navigation or tab bars). To keep your content within the area of a view that is not overlaid by translucent or transparent UIKit bars, employ the topLayoutGuide and bottomLayoutGuide properties in the UIViewController class and take advantage of Auto Layout. Query these properties within your implementation of the UIViewController method viewDidLayoutSubviews.

The guides work as follows:

The top layout guide indicates the distance, in points, between the top of a view controller’s view and the bottom of the bottommost bar that overlays the view

The bottom layout guide indicates the distance, in points, between the bottom of a view controller’s view and the top the bar (such as a tab bar) that overlays the view.

  If you are not using Auto Layout, you can make use of the length property and perform layout calculations yourself. Refer to the code snippets in the descriptions for the topLayoutGuide and bottomLayoutGuide properties, which explain how to obtain the numbers you need.

Import Statement
import UIKit

Availability
Available in iOS 7.0 and later.

Copyright © 2014 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2013-09-18

Feedback

*

** Required information

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UILayoutSupport_Protocol/index.html
时间: 2024-10-08 02:21:53

Layout Support 获取上下bar的长度的相关文章

获取Json对象的长度或计数

最近又开始写博客了.因为最近的工作又开始与技术方面接口了.现在在开发WEB的时候,经常会遇到JSON对象的传递,JSON是个好东西,但是它却没有提供一些简单便捷的处理方法,其中获取JSON对象的长度就成了很多实战开发中会遇到的问题之一. 下面呢,我把Javascript的代码提供出来,为什么只提供Javascript代码呢?因为其它语言都或多或少提供了一些关于JSON的操作,唯独JavaScript没有提供多少,然后在WEB开发过程中,现在对JQuery的依赖比较多,所以话不多说了,请看代码:

php中count获取多维数组长度的方法

本文实例讲述了php中count获取多维数组长度的实现方法.分享给大家供大家参考.具体分析如下: 先来看看下面程序运行结果: $numb=array(             array(10,15,30),array(10,15,30),array(10,15,30) ); echo count($numb,1); A.3B.12C.6D.9答案是Bcount函数中如果mode被设置为 COUNT_RECURSIVE(或 1),则会递归底计算多维数组中的数组的元素个数(也就是你结果的12).如

获取json对象的长度

在我们日常前端开发中,经常会用到ajax请求json数据,而json数据有数组和对象2种表示结构,对象和数组.而获取json数组结构的长度比较容易,但json对象结构的长度就比较麻烦.而本文就是对如何获取json对象的长度进行说明. 在说明如何获取json对象之前,我们需要了解下原生javaScript中的hasOwnProperty()方法,这个方法可以检测一个属性是存在于实例中,还是存在于原型中.只要给定属性存在于对象实例中,才会返回true.来看一个简单的例子. // 原型模式创建对象 f

c# 获取非托管指针长度

public List<string> GetPDFValues() { List<string> strs = new List<string>(); unsafe { var len = 0; //调用c++ 返回char** var a = GaussianDistributionServiceProxy.GetPDFValues(); var cx = 0; //获取char**指针长度 start while (true) { var result = Mar

iOS UITextFeild获取高亮部分的长度

获取原因: 中英文混输时,会遇到长度统计不准的问题. 获取方法: NSString *toBeString = textField.text; NSString *lang = [[UITextInputMode currentInputMode] primaryLanguage]; // 键盘输入模式 if ([lang isEqualToString:@"zh-Hans"]) { // 简体中文输入,包括简体拼音,健体五笔,简体手写 UITextRange *selectedRan

黄聪:C#如何通过MeasureString、Graphics获取字符串的像素长度

1.    使用g.MeasureString()获得 使用MeasureString测量出来的字符宽度,总是比实际宽度大一些,而且随着字符的长度增大,貌似实际宽度和测量宽度的差距也越来越大了.查了一下MSDN,找到了下面这个理由:MeasureString 方法旨在与个别字符串一起使用,它在字符串前后包括少量额外的空格供突出的标志符号使用. string str; str = "大"; Font f = new Font("SimSun", 7F, System.

js获取字符串的字节长度

占用3个字节的范围 U+2E80 - U+2EF3 : 0xE2 0xBA 0x80 - 0xE2 0xBB 0xB3 共 115 个 U+2F00 - U+2FD5 : 0xE2 0xBC 0x80 - 0xE2 0xBF 0x95 共 213 个 U+3005 - U+3029 : 0xE3 0x80 0x85 - 0xE3 0x80 0xA9 共 36 个 U+3038 - U+4DB5 : 0xE3 0x80 0xB8 - 0xE4 0xB6 0xB5 共 7549 个 U+4E00 -

通过findViewById()方法从layout中获取view并进行相应的转换时提示:&quot;Cannot cast from View to AutoCompleteTextView&quot;的解决办法!(转+自己错误)

转:http://blog.csdn.net/zyz511919766/article/details/7453864 代码: 1 package zyz.example.autocompletetextview; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.widget.ArrayAdapter; 6 7 public class AutoCompleteTextView exten

C#获取视频文件播放长度

下面两种方法只支持部分视频格式,一般格式mp3,wma等等支持 1.使用Shell32 添加引用,选择COM中的Microsoft Shell Controls And Automation引用 /// <summary> /// 长度分钟(支持mp4?) /// </summary> /// <param name="path"></param> /// <returns></returns> public st