iOS和OSX集成gitAPI
文章目录
【注意】最后更新于 May 17, 2017,文中内容可能已过时,请谨慎使用。
在项目中使用git submodule工具集成子项目ObjectiveGit
在新项目中使用git submodule集成gitAPI
参考官方提供的两个demo
OS X: CommitViewer
| |
cd External/ObjectiveGit,然后执行./script/bootstrap安装相关依赖.- 拖动
ObjectiveGitFramework.xcodeproj文件 到iOS/OSX项目导航窗口 . - 在build Phases中配置APP的依赖,根据平台添加
ObjectiveGit-MacorObjectiveGit-iOS. - APP通过连接器链接
ObjectiveGit.framework. - 在build setting中“Header Search Paths” (
HEADER_SEARCH_PATHS)设置libgit2头文件在项目的路径,例如:External/ObjectiveGit/External/libgit2/include. - Add a new “Copy Files” build phase, set the destination to “Frameworks” and add
ObjectiveGit.frameworkto the list. This will package the framework with your application as an embedded private framework.
- It’s hard to tell the difference between the platforms, but the Mac framework is in
build/Debugwhereas the iOS framework is inbuild/Debug-iphoneos
- Don’t forget to
#import <ObjectiveGit/ObjectiveGit.h>or@import ObjectiveGit;as you would with any other framework.
知识点
- 类变量关联.xib控件text值
- 字体样式菜单来改变字体样式
在OSX中设置控件的Bindings代替IBOutlet
先关联再使用属性依赖特性来同步数据
类变量关联.xib控件text值
- 选中NSTextField的bindings检查器面板
- 在
value单元内设置bind to 的值,通过下拉框选中Delegate - Model key Path:输入类变量的名称。
- 切换到 NSTextField/Delegate的Connections检查器面板,就会看到已经建立了关联:
依赖属性
Foundation 框架提供的表示属性依赖的机制如下: 参考属性的依赖
| |
将属性关联起来,这样就可以将类变量的值同步至UI控件中了:
| |
实现字体样式菜单来改变字体样式
- 在xib中拖一个Object并设置为NSFontManager.h类的实现。
- 选中NSFontManager.h的connections面板,将Received Actions关联到对应的菜单项即可
文章作者 iTBoyer
上次更新 2017-05-17