Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4244] iOS: Enable searchBar to animate cancel button

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-02-17T11:33:41.000+0000
Affected Version/sn/a
Fix Version/sSprint 2012-04, Release 2.0.0
ComponentsiOS
Labelscommunity, parity, qe-port
ReporterPhil Oye
AssigneeBlain Hamon
Created2011-05-25T06:10:33.000+0000
Updated2012-08-17T04:12:41.000+0000

Description

When a searchBar is NOT attached to a tableView, instead attached to a view on the window, the cancel button isn't animated. Nor does there seem to be a property to enable it. The cancel button IS animated when a searchBar is attached to a tableView. On the Q&A site, there is this: [http://developer.appcelerator.com/question/67231/searchbar-animate-cancel-button] Hidayet Dogan, looked at the source and wrote:

Change:

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

to

[search setShowsCancelButton:[TiUtils boolValue:value] animated:YES];
Could be a configurable option, I suppose, but having it match the tableView searchBar would probably make sense. The latter is not configurable.

Comments

  1. Paul Dowsett 2011-05-30

    In order for us to progress this ticket, please explicitly state your environment, ie your iOS SDK and Titanium versions. Thanks
  2. Phil Oye 2011-05-30

    iOS SDK: 4.3.2 (8H7) Titanium 1.7.0 (presumably RC1) Titanium Studio, build: 1.0.0.201105271818
  3. Hidayet Dogan 2012-02-02

    I made a pull request for it before 1.8 release. I also added option for it named "cancelAnimated". Documentation was also included. See the commit here: https://github.com/hdogan/titanium_mobile/commit/449476f042b62a221ac048795efcd6a871f7bf5d and the pull request: https://github.com/appcelerator/titanium_mobile/pull/562 But they haven't accepted it yet. I'll probably implement it using latest SDK (ie, 1.8) and attach pull request with this issue ID. They maybe notice the request at this time.
  4. Hidayet Dogan 2012-02-02

    Updated pull request with latest master branch (including documentation changes). https://github.com/appcelerator/titanium_mobile/pull/1329
  5. Neeraj Gupta 2012-02-02

    Hidayet - Thanks for your pull request. We will review it in next few days and get back to you if we have questions.
  6. Neeraj Gupta 2012-02-15

    Signed CLA is in place.
  7. Blain Hamon 2012-02-15

    To keep with the pattern of optional animated arguments in setters, I do want to have the following design pattern. The pull request will be up shortly, but Hidayet deserves full credit.
       
       var win=Ti.UI.createWindow({});
       win.open();
       
       var searchy = Ti.UI.createSearchBar({top:0,height:44});
       win.add(searchy);
       var showHide = false;
       
       var button1 = Ti.UI.createButton({top:60,height:40,width:220,title:'Toggle cancel animated'});
       var button2 = Ti.UI.createButton({top:120,height:40,width:220,title:'Toggle cancel plain'});
       win.add(button1);
       win.add(button2);
       
       button1.addEventListener('click',function(){
       	showHide = !showHide;
       	searchy.setShowCancel(showHide,{animated:true});
       });
       
       button2.addEventListener('click',function(){
       	showHide = !showHide;
       	searchy.setShowCancel(showHide,{animated:false});
       });
       
       
  8. Neeraj Gupta 2012-02-15

    Blain - Please make sure that we have this feature available on both iOS and Android platforms.
  9. Neeraj Gupta 2012-02-16

    Sabil - You should resolve this bug and open another bug for Android.
  10. Hidayet Dogan 2012-02-17

    I highly think that iOS and Android SDKs should be splitted. iOS features which does not supported by Android platform is totally pain for future Titanium SDK about supporting platform features. Ti.iOS, Ti.iPhone and Ti.iPad namespaces is not a solution. By the way Blain's pull request seems already pushed to master branch, I think this issue can be closed.
  11. Shyam Bhadauria 2012-08-17

    Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120816212512 Tested with Titanium  Studio: 2.1.1.201207271312 Device - iOS 5.1 simulator Machine OS - MAC 10.8

JSON Source