Bonjour je me demandais s'il n'y a aucun moyen d'ajouter un UITextField
& un UIButton
dans MKPinAnnotationView
bulle de légende et à son tour si l'utilisateur a cliqué sur le bouton, il va appeler une méthode?Comment ajouter un uitexfield et un uibutton dans l'appel MKPinAnnotationView?
1
A
Répondre
1
Vérifiez si ce didacticiel vous aide.
http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/
0
vous pouvez ajouter votre vue personnalisée au lieu de MKAnnotationView
avec le code ci-dessous ..
vous pouvez ajouter simplement un contrôle avec addSubview
propriété ...
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation
{
MKAnnotationView *customPinView = nil;
if(annotation != mapView.userLocation)
{
static NSString *defaultPinID = @"com.invasivecode.pin";
pinView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if (customPinView == nil)
customPinView = [[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:defaultPinID];
customPinView.canShowCallout = YES;
//customPinView.animatesDrop = YES;
customPinView.image = [UIImage imageNamed:@"yourImageName"];//write your imagename
// and add UIButton with bellow code
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self
action:@selector(ShowStoreDetail:)
forControlEvents:UIControlEventTouchUpInside];
customPinView.rightCalloutAccessoryView = rightButton;here
}
else {
[mapView.userLocation setTitle:@"I am here"];
}
return pinView;
}
je l'espère est utile à vous ...
:)
Questions connexes
- 1. UIButton intérieur MKPinAnnotationView avec l'image
- 2. Comment ajouter un UIButton à un UIButton
- 3. Comment ajouter un UIbutton dans un TableViewCell?
- 4. Ajouter un UIButton dans un PopOverController - Xcode
- 5. Comment ajouter un multiple UIButton dans un UITextView dans iOS
- 6. ajouter un uibutton sur uitableview
- 7. Ajouter UIView à un UIButton
- 8. Ajouter un dégradé à UIButton
- 9. Ajouter une image derrière MKPinAnnotationView
- 10. Comment ajouter un badge à UIButton
- 11. comment ajouter un accessoire à uibutton
- 12. Comment ajouter un cadre à UIButton
- 13. Comment ajouter un UIButton à Swift Playground?
- 14. Comment déplacer UItexfield de haut en bas?
- 15. Comment implémenter plusieurs légendes dans MKPinAnnotationView
- 16. Comment afficher MKPinAnnotationView sur MKMapview dans swift
- 17. Comment ajouter un UIButton personnalisé au fichier nib dans XCode?
- 18. Comment puis-je ajouter un badge à un UIButton standard?
- 19. iOS - comment ajouter un UIButton par rapport à un autre?
- 20. Comment ajouter un sélecteur nommé dynamiquement à un UIButton?
- 21. Comment ajouter une superposition à UIImage dans un UIButton
- 22. Comment ajouter un UIButton ou UISwitch dans tableView: viewForFooterInSection
- 23. UITexfield clavier démissionner
- 24. Comment ajouter une étiquette et un UIButton à un en-tête tableViewSection dans Swift?
- 25. Comment ajouter dynamiquement UIButton à UITableViewCell? UIButton peut être un ou plusieurs puis un
- 26. Comment animer un UIButton dans un UITableView?
- 27. Ajouter un espacement vertical entre UITextView et UIButton?
- 28. Bordure dans un UIButton
- 29. Comment faire glisser et déposer un UIButton
- 30. MKPinAnnotationView gauche bouton avec une image