zoukankan      html  css  js  c++  java
  • ios学习笔记

    1.对于autorelease的理解

      Each thread in a Cocoa application maintains its own stack of autorelease pool blocks.(Advanced Memory Management Programming Guide:Using Autorelease Pool Blocks)

         通过这句话,我们可以看出

    • autorelease pool 是栈的形式,and autorelease pool blocks can be nested
    • 主线程中也有自己的autorelease pool,这又牵扯出run loop。实际上,每次执行一次runloop时,就会释放当前autorelease pool中的对象。run loop 是ios中与线程有关的一个基础架构,用于处理事件循环的。

    2.对于runtime的理解

      The objective-c language defers as many decisions as it can from compile time and link time to runtime.

        这意味着oc不仅需要一个编译器,还需要一个运行时系统,来执行编译过的代码。这个运行时系统对于oc来说扮演着操作系统的角色。

    • In Objective-C, messages aren't bound to method implentationss until runtime.

    3.对于CALayer的理解

      Layer是Core Animation的核心。

      Layers are data objects that manage content provided by your app。

      A layer's content contains of a bitmap containing the visual data you want to display.有3种方法来设置它的content

    • 直接将一个对象分配给layer的content属性
    • 为layer指定个delegate对象,来delegate来draw它的content:displayLayer: 和drawLayer: inContent:
    • 子类一个layer,重写它的drawing方法:重写display或者drawInContext方法
  • 相关阅读:
    大端与小端编号方法的区别
    socket、listen 等函数的打电话隐喻
    windows 网络编程报错 error LNK2019
    有符号数与无符号数之间的转换
    C++ 代码命名建议
    编写启发式代码的方法
    求给定数目的前 n 个素数
    不使用 “+” 实现加法操作
    二叉搜索树中两个节点的旋转
    Python玩转硬件:TPYBoard-Micropython开发板大盘点
  • 原文地址:https://www.cnblogs.com/wustlj/p/3575205.html
Copyright © 2011-2022 走看看