Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Searchbar animate cancel button

Hi,

I have a searchbar that is NOT connected to a table view. I wan't to mimic the animation of the cancel button when the searchbar gains focus if it's connected to a tableview.

On focus I set showCancel to true and on blur I set it to false. But this does not produce any animation.

Any ideas on how to get the animation?

— asked October 4th 2010 by Magnus Ottosson
  • animate
  • cancel
  • searchbar
0 Comments

4 Answers

  • I'm also looking to do this. did you figure it out?

    Thanks

    — answered January 3rd 2011 by Dave F
    permalink
    1 Comment
    • Sorry, never solved this.

      — commented January 3rd 2011 by Magnus Ottosson
  • i've checked source code of SearchBar at github master branch and I think it's not possible at the moment. You can compile your own SDK to make it animated.

    in: iphone/Classes/TiUISearchBar.m

    About line 70:

    Change:

    [search setShowsCancelButton:[TiUtils boolValue:value]];

    to

    [search setShowsCancelButton:[TiUtils boolValue:value] animated:YES];

    I haven't tried by myself but it would be very nice feature to make it optional (or just make it default, so no more ugly/instant visible/hidden cancel buttons).

    — answered May 6th 2011 by Hidayet Doğan
    permalink
    1 Comment
    • I've tested it with latest github master branch and it works like a charm. I'm also working on scopeBar for searchBar UI component but I still couldn't get it working so I'm not an Obj-C guy :)

      — commented May 27th 2011 by Hidayet Doğan
  • If you look in the latest KitchenSink for Titanium 1.6.x you will see that table_view_api_search.js has the code you're looking for. :) Works flawless on my iPhone 4 and iPad 2!

    Cheers,
    Paul

    — answered May 6th 2011 by Paul Nelson
    permalink
    0 Comments
  • I logged an issue in Jira about this. Hopefully it can get addressed.

    — answered May 25th 2011 by Phil Oye
    permalink
    1 Comment
    • I should probably add that if you want this addressed, it would be a good idea to upvote the issue.

      — commented May 29th 2011 by Phil Oye
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.