zoukankan      html  css  js  c++  java
  • iOS开发小记(十四)

    网络层封装

    BaseMessage
    需求是什么?
    1,取消功能;
    2,加载提示;
    3,请求前判断网络;
    4,错误时,有业务层面错误,有http层错误;
    5,和业务无关;

    请求的时候,带上自己的delegate。
    center根据delegate可以做分类请求。

    LYHTTPAPIDelegate

    • (BOOL)isStatusCodeOK:(id responseObject);
    • (void)onHTTPerror:(NSError* error);
    • (void)onProgress:(NSProgress* progress);
      LYHTTPAPICenter

    layoutSubviews

    addSubview会触发layoutSubviews [不完全正确,当frame为0时是不会触发的]
    你不要直接调用方法layoutSubviews,如果想要刷新,请调用setNeedsLayout或者layoutIfNeeded
    一个view的frame值改变了,那么它的父类的layoutSubviews也会被执行
    地址

    NSRUNLOOP

    GCD定时器

    iOS 本地化应用程序(NSLocalizedString)

    iOS应用程序生命周期(前后台切换,应用的各种状态)详解

    IOS状态栏和导航栏的控制问题

    回调设计

    Cocoa Touch Target-Action 设计模式:改变状态的特定对象是用户界面对象的目标(target),方法是动作(action)。
    业务开发应用较多的是delegate模式和Block代码块回调。

    CMMotionManager

    必须是单例,只创建一次,多次会影响接受结果。
    运动传感器加速度传感器加速计(Motion/Accelerometer Sensor),环境光传感器(Ambient Light Sensor),距离传感器(Proximity Sensor),磁力计传感器(Magnetometer Sensor),内部温度传感器(Internal Temperature Sensor),湿度传感器(Moisture Sensor),陀螺仪(Gyroscope)
    手背对着屏幕中心,右手坐标系。

    循环引用

    @implementation EditUserInfoViewController
    {
         NSString *abc;
    }
    
        @weakify(self);
        [[NSNotificationCenter defaultCenter] addObserverForName:NOTIFY_UI_IMAGE_PICKER_DONE object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
            @strongify(self);
            [self submitPhoto:self.myPickImage url:URL_MODIFY_FACE];
             abc = @“abc”;
        }];
    
  • 相关阅读:
    刷题238. Product of Array Except Self
    刷题236. Lowest Common Ancestor of a Binary Tree
    刷题208. Implement Trie (Prefix Tree)
    A1070
    A1048
    A1050
    A1041
    A1092
    A1084
    n进制转十进制
  • 原文地址:https://www.cnblogs.com/loying/p/5660735.html
Copyright © 2011-2022 走看看