接下来添加头文件搜索目录, 选中 Targets 上面的 Project , 选择 Build Settings 标签页,在搜索框内输入 header search 进行过滤, 找到 Header Search Paths , 添加一行, 输入 ../MyLib , 并选中递归复选框。

现在要先验证一下对 MyLib 的引用是否正确, 打开 MyApp 项目的 ViewController.m , 添加对 MyLib.h 的引用, 如下图所示, 并编译 MyApp , 如果编译成功, 则表示引用正确。

打开 MainStoryboard.storyboard 文件, 在生成的 ViewController 上添加两个 UITextField 、 两个 UIButton 以及一个 UILabel, 如下图所示:

并添加相应的 outlet 和 action , ViewController.h 如下:
// // ViewController.h // MyApp // // Created by gdeic on 4/19/12. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import <UIKIT uikit.h> @interface ViewController : UIViewController @property (weak, nonatomic) IBOutlet UITextField *textField1; @property (weak, nonatomic) IBOutlet UITextField *textField2; @property (weak, nonatomic) IBOutlet UILabel *resultLabel; - (IBAction)addButtonClick:(id)sender; - (IBAction)connectButtonClick:(id)sender; @end