Skip to content

Latest commit

 

History

History
119 lines (78 loc) · 4.56 KB

iOS难点攻关.md

File metadata and controls

119 lines (78 loc) · 4.56 KB

iOS难点攻关

长期

  1. Swift5 vs Swift4

Core Animation

Swift

Cocoa Design Patterns

float

nan、inifinity

webview中

wkwebview

cell嵌套使用

autolayout布局有错误

线程安全问题

URLSession

when to use struct

Git

  • head、ref、config等基础概念的理解

translation in gesture

Property in OC

Typically you should specify accessor method names that are key-value coding compliant (see Key-Value Coding Programming Guide)—a common reason for using the getter decorator is to adhere to the isPropertyName convention for Boolean values.

  • 头文件中的@property只能说明在头文件中声明了setter和getter两个或其中的一个方法。.m文件中到底有没有是不确定的

  • 为啥按照这个格式写ClassName * qualifier variableName;

  • 当在attribute中写(getter=isWhat)时,使用点语法时,有哪些可能

  • Core Foundation属性有什么注意事项

Declared Properties

Core Foundation

用的不多,理解不够

  • Note: If you install a custom callback on a Core Foundation collection you are using, including a NULL callback, its memory management behavior is undefined when accessed from Objective-C.
  • Casting and Object Lifetime Semantics 这一节没看完

Core Foundation Memory Management

  • 内存管理原则和Foundation类似
    • 当方法名中有"Create"和"Copy"时,则retaincount + 1
    • 方法名中包含"Get"时,引用计数不变
    • 但是没有ARC,retain和release得自己写
  • 内存管理需要手动执行retain和release方法
    • 编译器无法知道CF对象的生命周期情况
  • 相比Foundation,Core Foundation缺少autorelease机制
    • 所以通常如果需要通过Get方法获取数据时,最好retain一把
  • 当将object当做参数传递时,方法中为了避免对象被释放,使用前最好也retain一把
    • 其实Foundation中也有类似问题,只是ARC下编译器会帮我们加上代码;MRR下,我们也是可以先retain一把的
  • 由于编译器不清楚CF对象的生命周期,而编译器又可以通过ARC管理Foundation对象的生命周期,那CF对象和Foundation对象相互cast时,需要指明内存管理标示
    • __bridge,可以用在两种对象互相转换时,ownership所有权没有任何改变

      • Foundataion下创建的对象转到CF时,告知CF,CF并没有拥有对象的所有权。相当于CF中Get方法获取对象
      • 反之亦然
       NSURL *url = [[NSURL alloc] initWithString:"http://fuck.com"];
       CFURLRef urlRef = (__bridge CFURLRef)url;
      

      url的所有权没有发生任何转义,还是ARC下管理,所以无需执行CFRelease释放urlRef

    • __bridge_retained或CFBridgingRetain,在Foundation对象转换到CF对象时使用,相当于CF在用create或copy方法获得一个对象,所以CF下要记得CFRelease

       CFURLRef urlRef = (__bridge_retained CFURLRef)url;
       // do with urlRef
       CFRelease(urlRef);
      

      urlRef拥有对url数据的所有权,所以要记得CFRelease(urlRef)释放

    • __bridge_transfer或CFBridgingRelease,CF对象转为Foundation对象时使用,CF放弃了对象的所有权,无需通过CFRelease再次释放

Memory Management Programming Guide for Core Foundation

Core Foundation Design Concepts

Sharing Access to keychain

OC Runtime Programing Guide

IndexSet

window.level

  • top window dertimine statusbar appearence

window programing guide

new feature in Swift5

Toll-Free Bridging

OutputStream

CoreAnimation完整Guide及核心概念联系

  1. layer的zPosition可以决定先展示哪个吗
  2. 哪些animatable的属性

xib、storyboard

短期

NSCoding