【问题标题】:Property implementation must have its declaration in interface 'FirstViewController'属性实现必须在接口“FirstViewController”中声明
【发布时间】:2013-06-15 22:25:25
【问题描述】:

我是 Objective-C 的新手,我很菜鸟。 我正在尝试将SecondViewController 中的UITextField 中的文本传递给FirstViewController。 我现在拥有的是:

(SecondViewController.h)

@interface SecondViewController : UIViewController <UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UITextField *PrimaryPhone;

@end

(FirstViewController.m)

#import "SecondViewController.h"

@interface FirstViewController ()

@end

@implementation FirstViewController

@synthesize PrimaryPhone;

.m 文件中包含其他默认项。

但它在哪里说:

@synthesize PrimaryPhone;

Xcode 给了我标题中的错误。 (属性实现必须在接口“FirstViewController”中声明)

【问题讨论】:

    标签: objective-c properties declaration synthesize


    【解决方案1】:

    您必须在 FirstViewController.h 中拥有属性 primaryPhone

    或者在界面中

    @interface FirstViewController ()

    @结束

    在 FirstViewController.m 中

    您尝试合成的对象属于 FirstViewController 类型的对象,但它是在 SecondViewController 类型的类中声明的。

    【讨论】:

      猜你喜欢
      • 2012-08-20
      • 1970-01-01
      • 2013-10-08
      • 2012-02-01
      • 2012-01-23
      • 1970-01-01
      • 1970-01-01
      • 2020-01-16
      相关资源
      最近更新 更多