Skip to content

Latest commit

 

History

History
executable file
·
73 lines (53 loc) · 1.06 KB

File metadata and controls

executable file
·
73 lines (53 loc) · 1.06 KB

0 - Init

- (instancetype)init {
    self = [super init];
    if (self) {
        // Init your instance
    }
    return self;
}

+ (instancetype)sharedKit {
    static NIMKit *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[NIMKit alloc] init];
    });
    return instance;
}

1 - Static

+ (NSString *)getAppTempPath {
    return NSTemporaryDirectory();
}

2 - Normal

// 无参
- (void)setupSubviews{ 
	// Do something
}

// 1 参
- (void)viewWillAppear:(BOOL)animated {
  // Do something
}

// 2 参
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
  // Do something
}

// 无参有返回值
- (NSString *)contentText {
    return self.toolBar.contentText;
}

3 - Lazy

- (UIButton *)deleteBtn {
    if (_deleteBtn == nil) {
        _deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_deleteBtn setImage:[UIImage imageNamedInModuleChat:@"chat_dellte"] forState:UIControlStateNormal];
    }
    return _deleteBtn;
}