我有时也使用没有问题的视图控制器之间传递数据,但不会这一次。请帮助
我FirstViewController.m
#import "SecondViewController.h"
- (IBAction)passBtn:(id)sender
{
SecondViewController *second =[[SecondViewController alloc] initWithNibName:nil bundle:nil];
second.stringData = dataString.text;
second.stringNumber = numberString.text;
second.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:second animated:YES];
}
我SecondViewController.h
#import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController
@property(nonatomic, retain) NSString *stringData;
@property(nonatomic, retain) NSString *stringNumber;
@end
和我得到这个错误,点到我的FirstViewController.m线second.stringData和second.stringNumber
Property 'stringData' not found on object of type 'SecondViewController *'
Property 'stringNumber' not found on object of type 'SecondViewController *'
我也有使用其他方法,但错误是一样的,总是说t在类型的对象上找不到帽子。但如果我Command +单击我的stringData或stringNumber,它真的把我带到我的SecondViewController.h并指向我的stringData或stringNumber。请帮忙。
其与我的不同,请。程序是相同的,但我有一些错误。 – Piyo 2012-08-08 11:16:26
这绝对是你的实际代码,因为它应该没问题。你是否得到任何其他编译器警告,或做任何其他进口?这是你的第二个控制器头文件的完整内容吗? – jrturton 2012-08-08 11:20:45
我同意,这不是链接问题的重复。 OP正在尝试做正确的事情,但有其他错误导致的错误。 – jrturton 2012-08-08 11:21:31