ios - 如何创建更干净的 UIViewController?

标签 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

如何更改苹果的或创建我自己的 viewContoller 模板?我使用 alcatraz 创建了一些模板,但它们不适合我。

最佳答案

克隆您想要自定义变体的模板。然后更改他们的名称和其中的信息。最后,将它们放在您帐户的 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/

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

关于ios - 如何创建更干净的 UIViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29910704/

相关文章:

ios - 尝试设置今日小部件时出现 Xcode 错误

ios - 使用 native iOS 模块扩展 Titanium

iphone - iOS 5 - 不再有 UDID - 如何保留一些关键日期以识别用户,即使应用已被删除

ios - AdMob GADBannerView 在 View 可见区域之外加载广告

ios - 如何清除/清零用于通过串行端口接收字符的 NSMutableString?

iphone - 在 Settings.app 中隐藏应用程序特定的设置

ios - iOS 应用程序中的核心数据和文本文件

ios - 无法为条形按钮项目设置图像

ios - 从 NSDictionary 中读取特定键

ios - Apple Mach-O 链接器错误 *对我来说很乱*