我开始在iOS开发中。我一直在寻找解决方案的日子,我无法得到它。我得到了下面的代码:在ViewController上找不到属性
@interface SAProfileViewController : UITableViewController {
@public NSNumber *userId;
}
@property (weak, nonatomic) IBOutlet UIView *awesomeProfileHeader;
@property (nonatomic, assign) NSNumber *userId;
@end
正如你可以看到我声明我的财产,在那之后我这样做:
@implementation SAProfileViewController
@synthesize userId = _userId;
...
上的其他视图控制器我导入SAProfileViewController。
#import "SAProfileViewController.h"
...
-(void)goToUserProfile :(id) sender
{
UITapGestureRecognizer *gesture = (UITapGestureRecognizer *) sender;
SAProfileViewController *controller = [[SAProfileViewController alloc] init];
controller.userId = gesture.view.tag; // << HERE THE ERROR APPEARS
[self.navigationController pushViewController:controller animated:YES];
}
就是这样,这是我的代码,我得到以下错误: “属性‘用户id’事先就输入‘SAProfileViewController *’
感谢的对象没有找到
Uhm。清理项目?另外:一旦你编译它会崩溃。看看'controller.userId'和'gesture.view.tag'的类型。 – 2013-02-09 22:07:21