美文网首页fighting~
Xcode中OC常用代码块

Xcode中OC常用代码块

作者: 吕木 | 来源:发表于2017-12-05 09:23 被阅读26次

Xcode-Code-Mark Of OC

简介

本文列举了以下代码块

  • Mark Section Title
  • Mark ChildNode Of Section
  • Singleton Instance
  • Standardize Structure Of Code (VC)
  • Standardize Structure Of Code (View)
  • Standardize Structure Of Code (Object)

如有问题,欢迎到GitHub上提出Issue。

以下开始干货:

Mark Section Title

Title Mark Section Title
Summary 内容标记
Completion Shortcut Mark Section Title
#pragma mark - <#Section Title #>

Mark ChildNode Of Section

Title Mark ChildNode Of Section
Summary 标记章节的子节点
Completion Shortcut Mark ChildNode Of Section
#pragma mark └ <#ChildNode#>

Singleton Instance

Title Singleton Instance
Summary 单例
Completion Shortcut Singleton Instance
+ (instancetype)sharedInstance {
    static dispatch_once_t pred;
    __strong static id instance = nil;
    dispatch_once( &pred, ^{
        instance = [[self alloc] init];
    });
    return instance;
}

Standardize Structure Of Code (VC)

Title Standardize Structure Of Code (VC)
Summary VC 代码结构
Completion Shortcut Structure VC
#pragma mark - LifeCycle 生命周期
#pragma mark └ Dealloc
- (void)dealloc {
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark └ Init
- (instancetype)init {
    if(self = [super init]) {
        
    }
    return self;
}
#pragma mark └ Content View Loading
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupContentViews];
    [self fetchContentData];
    [self setExtentdedLayoutEdgeZero];
}
/**
 *  初始化界面并设置布局
 */
- (void)setupContentViews {
    [self layoutPageSubViews];
}
/**
 *  设置布局
 */
- (void)layoutPageSubViews {
}
/**
 *  获取数据并绘制界面
 */
- (void)fetchContentData {
    [self renderContentViews];
}
/**
 *  绘制界面
 */
- (void)renderContentViews {
}
/**
 *  设置顶部导航栏拓展布局为空
 */
- (void)setExtentdedLayoutEdgeZero {
    if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }
}

#pragma mark - Event Response 事件响应
#pragma mark - Delegate Realization 委托方法
#pragma mark - Custom Method    自定义方法
#pragma mark └ Other
#pragma mark - Custom Accessors 自定义属性

Standardize Structure Of Code (View)

Title Standardize Structure Of Code (View)
Summary View 代码结构
Completion Shortcut Structure View
#pragma mark - + 静态方法
+ (instancetype)view {
    id view = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].firstObject;
    return view;
}
#pragma mark - Overridden Methods
#pragma mark └ Dealloc
- (void)dealloc { }
#pragma mark └ LifeCycle 生命周期
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self commonInit];
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    [self commonInit];
}

- (void)commonInit {
    
}
#pragma mark - Private Method    自定义方法
#pragma mark - Event Response 事件响应
#pragma mark - Delegate Realization 委托实现
#pragma mark - Helper Method 帮助方法
#pragma mark - Custom Accessors 自定义属性

Standardize Structure Of Code (Object)

Title Standardize Structure Of Code (Object)
Summary Object 代码结构
Completion Shortcut Structure Object
#pragma mark - LifeCycle 生命周期
#pragma mark └ Dealloc
- (void)dealloc {
}
#pragma mark └ Init
- (instancetype)init {
    if(self = [super init]) {
        
    }
    return self;
}

#pragma mark - Event Response 事件响应
#pragma mark - Delegate Realization 委托方法
#pragma mark - Custom Method    自定义方法
#pragma mark └ Other
#pragma mark - Custom Accessors 自定义属性

持续更新中...

相关文章

  • Xcode中OC常用代码块

    Xcode-Code-Mark Of OC 简介 本文列举了以下代码块 Mark Section Title Ma...

  • Xcode 代码块

    创建 Xcode 代码块快捷键可以提高代码输入速度。常用代码块如下: 将上面所需的代码块选中后,拖到 Xcode ...

  • xcode 常用代码块

    在Xcode10正式发布之后,喜欢使用代码块的小伙伴会发现,原先位于编辑器右下角的代码块标识被放到上面了,点击 {...

  • Xcode常用代码块

    代码块路径 (注意:如果你的xcode没有添加过代码块,那你是找不到这个文件夹的) ~/Library/Devel...

  • Xcode常用代码块

    Xcode的代码片段(Code Snippets)创建自定义的代码片段,当你重用这些代码片段时,会给你带来很大的方...

  • Xcode 常用代码块

    在Xcode10正式发布之后,原先位于编辑器右下角的代码块标识被放到右上角的状态栏里,点击 {}按钮之后会将所有的...

  • xcode 创建可以复用的代码块

    #######摘要: 我们可以常用的代码块创建为模板,方便代码的复用,提高编码效率。Xcode创建可复用的代码块 ...

  • 常用的Xcode 代码块

    不废话 一、常用代码块 1、strong: @property (nonatomic, strong) <#Cla...

  • Xcode 代码块 (show snippets library

    代码块:事先存储到某处通过关键字调用的代码,比如常用的if语句就是设定好的代码块。 最新Xcode代码块(Snip...

  • iOS 获取汇编输出方法

    Xcode获取oc代码汇编输出 Xcode -> Product -> Perform Action -> Ass...

网友评论

    本文标题:Xcode中OC常用代码块

    本文链接:https://www.haomeiwen.com/subject/wehjkxtx.html