我克隆并修改了 Apple 的 iOS 项目模板,并且能够将其方法之一定义如下:
<key>Definitions</key>
<dict>
<key>___VARIABLE_classPrefix:identifier___AppDelegate.m:applicationdidFinishLaunchingWithOptions</key>
<string>- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIViewController *mainViewController = [[AppMainViewController alloc] init];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
self.window.rootViewController = mainViewController;
return YES;
}
</string>
该代码在 AppDelegate.m 中很好地生成了但是以下不会生成“myMethod”
<key>___VARIABLE_classPrefix:identifier___AppDelegate.m:myMethod</key>
<string>- (void)myMethod:(NSManagedObjectContext *) managedObjectContext
{
//my code
}
</string>
如何通过模板定义将我自己的方法引入到类中?谢谢!!