J'essaie de créer une barre de recherche similaire à celle du navigateur Safari sur iPad. Je pense que c'est un UITextview seulement. Au clic du contrôle, sa taille va augmenter. Et quand l'orientation est tournée, elle maintient la taille en conséquence. Comment puis-je y parvenir en utilisant l'option de redimensionnement automatique? Ou dois-je coder manuellement pour l'atteindre?Question iPad simple - Navigateur Safari - Barre de recherche Google
0
A
Répondre
1
Vous pouvez faire tout cela directement dans Interface Builder.
Le composant Barre de recherche vous offre les fonctionnalités appropriées. Pour que la barre se redimensionne correctement, il vous suffit de l'ancrer aux côtés appropriés de l'écran et de le rendre extensible. Essayez d'ouvrir this file avec IB pour un exemple.
0
Use the below code to your controller and make sure the you have a textfield delegate.
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
UIInterfaceOrientation orientation = self.interfaceOrientation;
if (orientation== UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
if(textField==searchField){
CGRect searchFrame = searchField.frame;
searchFrame.size.width += 150;
searchFrame.origin.x -= 150;
[UIView beginAnimations: @"GrowTextField" context: nil];
{
searchField.frame = searchFrame;
[UIView setAnimationDuration: 0.5];
}
[UIView commitAnimations];
}
}
else if(orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{
if(textField==searchField){
CGRect searchFrame = searchField.frame;
searchFrame.size.width += 150;
searchFrame.origin.x -= 150;
[UIView beginAnimations: @"GrowTextField" context: nil];
{
searchField.frame = searchFrame;
[UIView setAnimationDuration: 0.5];
}
[UIView commitAnimations];
}
}
}
- (void)textFieldDidEndEditing:(UITextField *)textField{
UIInterfaceOrientation orientation = self.interfaceOrientation;
if (orientation== UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
if(textField==searchField){
CGRect searchFrame = searchField.frame;
searchFrame.size.width -= 150;
searchFrame.origin.x += 150;
[UIView beginAnimations: @"ShrinkTextField" context: nil];
{
searchField.frame = searchFrame;
[UIView setAnimationDuration: 0.5];
}
[UIView commitAnimations];
}
}
else if(orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{
if(textField==searchField){
CGRect searchFrame = searchField.frame;
searchFrame.size.width -= 150;
searchFrame.origin.x += 150;
[UIView beginAnimations: @"ShrinkTextField" context: nil];
{
searchField.frame = searchFrame;
[UIView setAnimationDuration: 0.5];
}
[UIView commitAnimations];
}
}
}
Questions connexes
- 1. recherche de barre d'étendue iPad
- 2. Comment lancer le navigateur Safari depuis une application iPad?
- 3. recréer la barre de recherche ipad dans l'application de contacts
- 4. barre de recherche iPad mauvais accès à la mémoire?
- 5. google api dans ipad
- 6. Safari: recherche texte caché
- 7. Question d'expression régulière simple (recherche dans VS2008)
- 8. iPhone/iPad Safari performances Javascript
- 9. Site web iPad plein écran dans Safari
- 10. API Google Analytics et recherche interne question
- 11. iPhone SDK - Barre de recherche Synchronisation de thread Question
- 12. ombre de boîte sur un ipad/safari
- 13. Une autre question simple barre de progression jQuery
- 14. Barre de recherche UITableView?
- 15. question script GUI simple
- 16. Éléments graphiques non affectés aux éléments parents sur Safari iPad lors de l'utilisation de Google Closure
- 17. Django Haystack simple question de moteur de recherche
- 18. Redimensionner la barre de recherche Google map dans GWT
- 19. jquery JScrollPane ipad question
- 20. iPad UISPlitViewController question
- 21. Google Analytics - Question sur comment cela affecte les résultats de recherche sur Google
- 22. jQuery trigger cliquez sur mobile Safari (iPad)
- 23. Charger un safari depuis l'application ipad
- 24. Problème de barre de défilement avec les tables dans le navigateur Safari
- 25. Simple Jquery Question
- 26. iPad UIWebView Affichage de la barre d'outils Action
- 27. Simple question d'expression régulière
- 28. Créer une barre d'outils de navigateur?
- 29. Chrome fadeIn barre de défilement question
- 30. OpenFeint + iPad + Masquage de la barre d'état