我开始从事 iOS 开发。几天来我一直在寻找解决方案,但我无法得到它。我得到以下代码:
@interface SAProfileViewController : UITableViewController {
@public NSNumber *userId;
}
@property (weak, nonatomic) IBOutlet UIView *awesomeProfileHeader;
@property (nonatomic, assign) NSNumber *userId;
@end
如您所见,我正在声明我的财产,然后我这样做:
@implementation SAProfileViewController
@synthesize userId = _userId;
...
在另一个 ViewController 上,我导入 SAPProfileViewController。
#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];
}
就是这样,这是我的代码,我收到以下错误:“在'SAProfileViewController *'类型的对象上找不到属性'userId'
提前致谢。