如何创建更清洁的UIViewContoller?

时间:2015-04-28 05:03:59

标签: ios objective-c xcode

总是,当我创建ViewController时,我有这个:

#import "SomeVCC.h"
@interface SomeVC ()

@end

@implementation SomeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

通常我需要一些更清洁的版本,如下:

#import "SomeVC.h"
@interface SomeVC ()

@end

@implementation SomeVC
#pragma mark - LifeCycle
- (void)viewDidLoad
{
    [super viewDidLoad];
}

@end

如何更改apple或创建自己的viewContoller模板?我使用恶魔岛建立了一些模板,但它们不适合我。

1 个答案:

答案 0 :(得分:1)

克隆您想要自定义变体的模板。然后更改其名称和信息。最后,将它们放在帐户Library/Application Support文件夹中的相应位置,具体为:

文件模板 ~/Library/Application Support/Developer/Shared/Xcode/File Templates/
目标模板: ~/Library/Application Support/Developer/Shared/Xcode/Target Templates/
项目模板: ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/

这样,当您安装新的开发人员工具时,他们不会被覆盖,您可以根据自己的内容调整它们。