- (void) tapGesture: (id)sender
{
UITapGestureRecognizer *gesture = (UITapGestureRecognizer *) sender;
NSInteger userID = gesture.view.tag;
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main"
bundle:nil];
OthersProfile *vc = (OthersProfile*)[storyboard instantiateViewControllerWithIdentifier:@"othersprofile"];
NSString *strUserID = [NSString stringWithFormat:@"%ld", (long)userID];
vc.userID = strUserID;
[self.viewController.navigationController pushViewController:vc
animated:YES];
}
訪問迅速財產它使用Xcode中8 /斯威夫特3工作,但好像有在Xcode 9個問題,並迅速4.從objC
我有沒有發現錯誤屬性的用戶ID。
在斯威夫特文件:
var userID : String = ""
override func viewDidLoad() {
print(userID) //no value here
}
有任何想法,任何人?
您確定此代碼在XCode8中工作? –
@PuneetSharma對不起,我更新了我的問題 –
Swift 4不再向Objective-C運行時公開所有內容,因此您可能必須使用'@ objc'來註釋屬性 – ctietze