开始唠叨唠叨一些细节:git
系统模板的路径(Xcode7,8,9)/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates在这个目录下有 github
把文件copy吧,系统会提醒须要输入管理员密码。放心输入,否则无法下一步操做。编程
假设已经将BaseVC.xctemplate放入了Source文件夹中,查看BaseVC.xctemplate中有 (1)BaseViewControllerObjective-C 文件夹 用来建立.h 和 .m文件。 其中文件夹的命名规范是[name]+Objective-C. 若是是建立swift修改成swift。 (2)BaseViewControllerXibObjective-C文件夹 用来建立.h,.m和.xib文件。其中文件夹的命名规范是[name]+XibObjective-C. swift相似。 (3)TemplateIcon图片 图片是用来显示在New File的菜单上的。任意放一个本身喜欢的图片,像素138*138便可。 (4)TemplateInfo.plist 配置文件。下面单独讲讲。swift
___FILEBASENAME___.h
内容为bash
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//
#import "___VARIABLE_cocoaTouchSubclass___.h"
@interface ___FILEBASENAMEASIDENTIFIER___ : ___VARIABLE_cocoaTouchSubclass___
@end
复制代码
里面的参数在生成h文件时,系统会替换了输入的文件名。具体都是什么含义,你们能够自行Google了。app
___FILEBASENAME___.m
内容为ide
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//
#import "___FILEBASENAME___.h"
// Controllers
// Model
// Views
//#define <#macro#> <#value#>
@interface ___FILEBASENAMEASIDENTIFIER___ ()
//@property (nonatomic, strong) <#type#> *<#name#>
@end
@implementation ___FILEBASENAMEASIDENTIFIER___
#pragma mark - View Controller LifeCyle
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self initialNavigationBar];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
[[SDImageCache sharedImageCache] setValue:nil forKey:@"memCache"];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - Override
#pragma mark - Initial Methods
- (void)initialNavigationBar
{
// self.navigationItem.title = <#title#>;
}
#pragma mark - Target Methods
#pragma mark - Notification Methods
#pragma mark - KVO Methods
#pragma mark - UITableViewDelegate, UITableViewDataSource
#pragma mark - Privater Methods
#pragma mark - Setter Getter Methods
@end
复制代码
按编程规范编写的,你们能够自行修改,New File后将自动生成你修改的内容。 有什么异议能够看看iOS代码编程规范。布局
Next ui
结果 atom
成功。
有啥没说清楚的,给我评论。