`
反求诸己
  • 浏览: 534722 次
  • 性别: Icon_minigender_1
  • 来自: 湖南娄底
社区版块
存档分类
最新评论

IOS Content Modes

 
阅读更多

Content Modes:

View 通过 content mode 来控制在 view 几何变化时如何 recyle view 的内容,或者
是否 recyle view 的内容。当一个 view 首次展示,view 会被抓取一个 bitmap,
之后 view 的几何变化不会总是导致 bitmap 的重建,content mode 决定 bitmap 是否
扩展到新边界或是移动到一角或一边。

在做如下操作时,会应用 content mode

* 改变 frame 或 bounds 矩形的 with 或 height
* 给view 的 transform 分配一个 transform

默认情况,View 的 contentMode 属性是 UIViewContentModeScaleToFill, 这会是view
的内容拉伸来适应新的大小。 Figure 1-2 展示了不同 contentMode 值,如何展示 view.

Figure1-2 Content mode cpmparisions



你也可以指定你的 contentMode 属性值为 UIViewContentModeRedraw , 当你的订制view
发生几何变化时调用自己的方法绘制他们,系统会调用你 view 的 drawRect: 方法
,你应该避免使用这个方法,你也不能将这个属性值用在系统标准view 中。

分享到:
评论

相关推荐

    ios-下拉放大.zip

    图片框:顶部,ContentModel设置为AspectFill 内容列表:和根视图一样大 2、设置内容列表的contentInset,top为图片框的高度;backgroundColor为clearColor,这样图片框就显示出来了 3、滚动内容列表,实现...

    ios-自定义cell展开与收起.zip

    CGSize size = [self.model.content boundingRectWithSize:CGSizeMake(kWidth - 30, 0) options:option attributes:attribute context:nil].size; [_contentLabel setFrame:CGRectMake(15, 30, kWidth - 30, ...

    iOS.Recipes(第1版)

    Place Static Content in a Zoomable Scroll View Build a Carousel Paging Scroll View Graphics Recipes Draw Gradient Filled Bezier Paths Create Dynamic Images With Multiple Animations Make Composited ...

    IOS5 Programming Cookbook

    2.18 Creating Scrollable Content with UIScrollView 226 2.19 Loading Web Pages with UIWebView 231 2.20 Presenting Master-Detail Views with UISplitViewController 237 2.21 Enabling Paging with ...

    ios-UItableViewCell 自适应 (SDAutoLayout).zip

    使用SDAutoLayout 自适应... 四个属性, 需要自适应的label为 textLabel1, 白 糗事百科的数据接口封装在model中 然后添加在数据中, 把需要自适应的数据 model.content添加到数组中. 让后通过该SDAutoLayout实现自适应.

    SwiftUI 示例 iFonts 应用完整项目源代码

    内容概要 ...│ ├── Preview Content │ ├── SFSymbolNames │ ├── SceneDelegate.swift │ └── View └── iFonts.xcodeproj ├── project.pbxproj ├── project.xcworkspace

    Amazon S3 Cookbook(PACKT,2015)

    In addition to this, the book covers several practical recipes about how to distribute your content with CloudFront, secure your content with IAM, optimize Amazon S3 performance, and notify S3 events...

    Amazon.S3.Cookbook.1785280708

    The book starts by showing you how to install several AWS SDKs such as iOS, Java, Node.js, PHP, Python, and Ruby and shows you how to manage objects. Then, you'll be taught how to use the installed ...

    简易外卖点餐界面

    源码CCDoubleTableView...content内装TakeOutModel,每个model有 食品标题 食品id 已经售出的份数 价格 图像地址 等属性,您也可以自己添加属性并进行扩展 这是我的第一个项目,可能会有问题,还请您多包涵,多多指正。

    test:增强现实(AR)地质模型

    h1 :: after {content:url(“ logo.jpg”); 显示:inline-block; 职位:相对宽度:32px; 顶部:32px; } </ style> [removed] document.querySelector(“ header h1”)。textContent ='地质二十一世纪'...

    ionic 实现商品分类

    <input class="small-text" type="search" ng-model="searchStr" style="background: transparent;width: 100%" placeholder="请输入商品名称"> <div class="button icon-right ion-ios-cart-outline button...

    _storage_emulated_0_android_data_com.tencent.mm_MicroMsg_Download_FRM.Support0423_2510(Frame.2023).zip

    _storage_emulated_0_android_data_com.tencent.mm_MicroMsg_Download_FRM.Support0423_2510(Frame.2023).zip

Global site tag (gtag.js) - Google Analytics