测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | BSD |
发布最新发布 | 2015 年 5 月 |
由 Michael Robinson 和 Michael Robinson 管理。
在您的 Cocoa 应用程序中使用精彩的 ACE 编辑器。
为了伟大的正义。
使用 ACEView 非常简单。首先将 ACEView 框架添加到您的项目中(有关如何做到这一点,请参阅 链接库或框架),然后向 XIB 中添加一个视图,并指定其为 ACEView
*注意,ACEView 有一些依赖项 - 您可以使用 CocoaPods,或者在内克隆 ACEView 的文件夹中运行:git submodule update --init --recursive
确保您在视图控制器中有一个 IBOutlet,并将其绑定
现在,您可以这样做
#import "Cocoa/Cocoa.h"
#import "ACEView/ACEView.h"
@interface AppDelegate : NSObject <NSApplicationDelegate, ACEViewDelegate> {
IBOutlet ACEView *aceView;
}
@property (assign) IBOutlet NSWindow *window;
@end
#import "AppDelegate.h"
#import "ACEView/ACEView.h"
#import "ACEView/ACEModeNames.h"
#import "ACEView/ACEThemeNames.h"
@implementation AppDelegate
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification {
// Note that you'll likely be using local text
[aceView setString:[NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://github.com/faceleg/ACEView"] encoding:NSUTF8StringEncoding
error:nil]];
[aceView setDelegate:self];
[aceView setMode:ACEModeHTML];
[aceView setTheme:ACEThemeXcode];
[aceView setShowInvisibles:YES];
}
- (void) textDidChange:(NSNotification *)notification {
NSLog(@"%s", __PRETTY_FUNCTION__);
}
@end