Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-4244] Enable searchBar to animate cancel button #1329

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions apidoc/Titanium/UI/SearchBar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ properties:
- name: barColor
summary: the bar color of the search bar view
type: String
- name: cancelAnimated
summary: boolean to indicate if the cancel button will be displayed with animation
platforms: [iphone, ipad]
default: false
type: Boolean
- name: hintText
summary: the text to show when the search bar field is not focused
type: String
Expand Down
1 change: 1 addition & 0 deletions iphone/Classes/TiUISearchBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
UISearchBar *searchView;
CALayer * backgroundLayer;
id<UISearchBarDelegate> delegate;
BOOL cancelAnimated;
}

-(void)setDelegate:(id<UISearchBarDelegate>)delegate;
Expand Down
7 changes: 6 additions & 1 deletion iphone/Classes/TiUISearchBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,15 @@ -(void)setValue_:(id)value
-(void)setShowCancel_:(id)value
{
UISearchBar *search = [self searchBar];
[search setShowsCancelButton:[TiUtils boolValue:value]];
[search setShowsCancelButton:[TiUtils boolValue:value] animated:cancelAnimated];
[search sizeToFit];
}

-(void)setCancelAnimated_:(id)value
{
cancelAnimated = [TiUtils boolValue:value def:NO];
}

-(void)setHintText_:(id)value
{
[[self searchBar] setPlaceholder:[TiUtils stringValue:value]];
Expand Down