Skip to content

Commit

Permalink
Merge pull request #4133 from mstepanov/timob-13499-31x
Browse files Browse the repository at this point in the history
[TIMOB-13499] iOS: ListView: clear selection on show
  • Loading branch information
vishalduggal committed Apr 9, 2013
2 parents c29bb12 + a765154 commit 485b313
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions iphone/Classes/TiUIListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

@interface TiUIListView : TiUIView <UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate, TiScrolling >

#pragma mark - Private APIs

@property (nonatomic, readonly) UITableView *tableView;

- (void)setTemplates_:(id)args;
- (void)deselectAll:(BOOL)animated;

+ (UITableViewRowAnimation)animationStyleForProperties:(NSDictionary*)properties;

Expand Down
11 changes: 10 additions & 1 deletion iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ - (TiUIListViewProxy *)listViewProxy
return (TiUIListViewProxy *)self.proxy;
}

#pragma mark - Public API
- (void)deselectAll:(BOOL)animated
{
if (_tableView != nil) {
[_tableView.indexPathsForSelectedRows enumerateObjectsUsingBlock:^(NSIndexPath *indexPath, NSUInteger idx, BOOL *stop) {
[_tableView deselectRowAtIndexPath:indexPath animated:animated];
}];
}
}

- (void)setTemplates_:(id)args
{
Expand All @@ -101,6 +108,8 @@ - (void)setTemplates_:(id)args
}
}

#pragma mark - Public API

- (void)setDefaultItemTemplate_:(id)args
{
if (![args isKindOfClass:[NSString class]] && ![args isKindOfClass:[NSNumber class]]) {
Expand Down
6 changes: 6 additions & 0 deletions iphone/Classes/TiUIListViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ - (void)viewDidAttach
[self.listView tableView];
}

- (void)willShow
{
[self.listView deselectAll:YES];
[super willShow];
}

#pragma mark - Public API

- (void)setTemplates:(id)args
Expand Down

0 comments on commit 485b313

Please sign in to comment.