- (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];
}
Il travaillait avec Xcode 8/Swift 3, mais semble comme il y a un problème avec Xcode 9 et rapide 4.accès à une propriété rapide de objc
J'ai USERID propriété introuvable erreur.
Dans le fichier Swift:
var userID : String = ""
override func viewDidLoad() {
print(userID) //no value here
}
Toute personne ayant une idée?
Etes-vous sûr que ce code fonctionnait dans XCode8? –
@PuneetSharma désolé j'ai mis à jour ma question –
Swift 4 n'expose plus tout à l'exécution d'Objective-C, donc vous pouvez devoir annoter la propriété avec '@ objc' – ctietze