• iOS开发小记(十一)


     ATS

    http://www.baidu.com 需要配置ATS

    Specifically, with ATS enabled, HTTP connections must use HTTPS (RFC 2818). Attempts to connect using insecure HTTP fail. Furthermore, HTTPS requests must use best practices for secure communications

     

    宏定义

    NS_ASSUME_NONNULL_BEGIN
    NS_ASSUME_NONNULL_END
    NS_ASSUME_NONNULL_BEGIN和NS_ASSUME_NONNULL_END。在这两个宏之间的代码,所有简单指针对象都被假定为nonnull,因此我们只需要去指定那些nullable的指针。
     
     
     

    面对对象

    封装、继承、多态
    父类指向子类的指针,会因子类的不同而不同。
    多态-重写、重载。OC不支持重载。
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellWithIdentifier]; 
    cell指针就有多态
     

    setter和getter

    重写一个NSString类型的,retain方式声明name属性的setter和getter方法

    -(void)settetName:(NSString *)name{
      if(_name){
      [_name release];
    }
      _name = [name retain];
    }
    -(NSString *)getterName{
       return [[_name retain]autorelease];
    }
     

    类别和延展

    类别是把类的实现方法分散到不同的文件中 也可以给类扩展新方法

    延展是给类添加私有方法 只为自己类所见 所使用
     
     

    运行时机制

    class_addProperty 与   class_addIvar

    /// An opaque type that represents a method in a class definition.
    typedef struct objc_method *Method;
    类定义的方法类型

    /// An opaque type that represents an instance variable.
    typedef struct objc_ivar *Ivar;
    实例对象的变量

    /// An opaque type that represents a category.
    typedef struct objc_category *Category;
    类别
     
    /// An opaque type that represents an Objective-C declared property.
    typedef struct objc_property *objc_property_t;
    类声明的变量
     
     

    APP架构

    网络层 - 数据层 - 逻辑业务层 - 显示层
    盈盈的例子:
    json - oc类 - 按照业务组合数据 - MVVM架构绑定显示
     
     

    透明的导航栏

    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
     
     
     
     

    NSURL

    fileURLWithPath
    和URLWithPath
     
    + (id)URLWithString:(NSString *)URLString
    
    Parameters
    
    URLString
    
    The string with which to initialize the NSURL object. Must be a URL that conforms to RFC 2396. This method parses URLString according to RFCs 1738 and 1808. (To create NSURL objects for file system paths, usefileURLWithPath:isDirectory: instead.)
    
     
     
    
    + (id)fileURLWithPath:(NSString *)path
    
    Parameters
    
    path
    
    The path that the NSURL object will represent. path should be a valid system path. If path begins with a tilde, it must first be expanded with stringByExpandingTildeInPath. If path is a relative path, it is treated as being relative to the current working directory.
    
     
    Passing nil for this parameter produces an exception. 
     
  • 相关阅读:
    linux free
    uptime
    简述负载均衡&CDN技术(转)
    大胆地去做自己坚信的事情,去做不伤害国家和客户的事情 做企业一定要专注。为企业制定战略目标,绝对不能超过三个。超过三个,你就记不住了,员工也记不住
    同一路由器不同vlan之间的通信(一)
    计算机基础之计算机网络与安全
    LayoutInflater的使用
    插入排序
    Java NIO与IO
    高速排序算法
  • 原文地址:https://www.cnblogs.com/loying/p/5253225.html
Copyright © 2020-2023  润新知