mercredi 3 septembre 2014

Search Bar inside SpriteKit Application


Vote count:

0




Needing to implement a search feature inside a SpriteKit SKScene to traverse through my SKScene's NodeTree.


It may sound like a strange task, but I am confident that it's doable and something that will add unique value to users. I am hoping someone else out there has given it a shot and is willing to disclose their methods to success. (if not, I will share my solution upon completion)


Where I am now:



  1. Accessing SKTextureAtlas

  2. Adding the SKTexture *searchNode to the scene with searchNode.name = @"search"

  3. Creating a UITextField then setting textField.center to the node's position in scene.

  4. Setting textField.boarderStyle = UITextFieldBoarderStyleNone;

  5. Applying a UITextFieldDelegate to the scene

  6. Creating private BOOL searching

  7. In initWithSize: setting self.search = NO;

  8. Using SKScene's touchesBegan: withEvent:

  9. if ([[self nodeAtPoint:point].name isEqualToString:@"search"]) self.searching = YES; Upon user tap

  10. Inside update

  11. if(_searching) {

  12. UITextField *searchText = [self startSearch] *startSearch returns textField

  13. [self.view addSubview:searchText]; } ends the if statement.


What I need (toDo still):



  1. Keyboard Results dynamically responding to NodeTree based on user input

  2. Displaying child node matches on screen


interested in: Anything else that may make the search functionality creative and useful.


Sorry for the awful code presentation. I made it a step by step list because it's still pretty mangled and needs refactoring.


Thanks!



asked 31 secs ago







Search Bar inside SpriteKit Application

Aucun commentaire:

Enregistrer un commentaire