我開始在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