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-16355](5_2_X) iOS: separatorInsets should not be used for header/sect… #7829

Merged
merged 2 commits into from
Mar 14, 2016
Merged
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
43 changes: 43 additions & 0 deletions apidoc/Titanium/UI/ListView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,9 @@ properties:

- name: separatorInsets
summary: The insets for list view separators (applies to all cells). This property is applicable on iOS 7 and greater.
deprecated:
since: "5.2.0"
notes: Use tableSeparatorInsets instead
description: |
In iOS 7 and later, cell separators do not extend all the way to the edge of the list view.
This property sets the default inset for all cells in the table.
Expand All @@ -875,6 +878,46 @@ properties:
platforms: [iphone, ipad]
availability: creation

- name: tableSeparatorInsets
summary: The insets for the table view header and footer. This property is applicable on iOS 7 and greater.
description: |
In iOS 7 and later, cell separators do not extend all the way to the edge of the list view. Set this to a
dictionary with two keys, `left` specifying inset from left edge and `right` specifying the inset from the
right edge. If the rowSeparatorInsets is not set, the tableSeparatorInsets will also set the cell insets.

For example:

listView.setTableSeparatorInsets({
left:10,
right:10
});


type: Dictionary
since: "5.2.0"
osver: {ios: {min: "7.0"}}
platforms: [iphone, ipad]


- name: rowSeparatorInsets
summary: The insets for list view cells (applies to all cells). This property is applicable on iOS 7 and greater.
description: |
In iOS 7 and later, cell separators do not extend all the way to the edge of the list view. Set this to a
dictionary with two keys, `left` specifying inset from left edge and `right` specifying the inset from the
right edge. This property is only available upon creation of the cells.

For example:

listView.setRowSeparatorInsets({
left:10,
right:10
});


type: Dictionary
since: "5.2.0"
osver: {ios: {min: "7.0"}}
platforms: [iphone, ipad]

methods:

Expand Down
10 changes: 5 additions & 5 deletions apidoc/Titanium/UI/TableView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ properties:
- name: separatorInsets
summary: The insets for table view separators (applies to all cells). This property is applicable on iOS 7 and greater.
deprecated:
since: "6.0.0"
since: "5.2.0"
notes: Use tableSeparatorInsets instead
description: |
In iOS 7 and later, cell separators do not extend all the way to the edge of the table view.
Expand All @@ -1572,7 +1572,7 @@ properties:
- name: tableSeparatorInsets
summary: The insets for the table view header and footer. This property is applicable on iOS 7 and greater.
description: |
In iOS 7 and later, cell separators do not extend all the way to the edge of the table view.Set this to a
In iOS 7 and later, cell separators do not extend all the way to the edge of the table view. Set this to a
dictionary with two keys, `left` specifying inset from left edge and `right` specifying the inset from the
right edge. If the rowSeparatorInsets is not set, the tableSeparatorInsets will also set the cell insets.

Expand All @@ -1585,14 +1585,14 @@ properties:


type: Dictionary
since: 6.0.0
since: "5.2.0"
osver: {ios: {min: "7.0"}}
platforms: [iphone, ipad]

- name: rowSeparatorInsets
summary: The insets for table view cells (applies to all cells). This property is applicable on iOS 7 and greater.
description: |
In iOS 7 and later, cell separators do not extend all the way to the edge of the table view.Set this to a
In iOS 7 and later, cell separators do not extend all the way to the edge of the table view. Set this to a
dictionary with two keys, `left` specifying inset from left edge and `right` specifying the inset from the
right edge. This property is only available upon creation of the cells.

Expand All @@ -1605,7 +1605,7 @@ properties:


type: Dictionary
since: 6.0.0
since: "5.2.0"
osver: {ios: {min: "7.0"}}
platforms: [iphone, ipad]

Expand Down
34 changes: 30 additions & 4 deletions iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ @implementation TiUIListView {
BOOL keepSectionsInSearch;
NSMutableArray* _searchResults;
UIEdgeInsets _defaultSeparatorInsets;
UIEdgeInsets _rowSeparatorInsets;


NSMutableDictionary* _measureProxies;

Expand Down Expand Up @@ -538,15 +540,36 @@ -(NSInteger)sectionForSearchSection:(NSInteger)section
-(void)setSeparatorInsets_:(id)arg
{
[self tableView];
DEPRECATED_REPLACED(@"UI.ListView.separatorInsets", @"5.2.0", @"UI.ListView.tableSeparatorInsets");
}
-(void)setTableSeparatorInsets_:(id)arg
{
[self tableView];

if ([arg isKindOfClass:[NSDictionary class]]) {
CGFloat left = [TiUtils floatValue:@"left" properties:arg def:_defaultSeparatorInsets.left];
CGFloat right = [TiUtils floatValue:@"right" properties:arg def:_defaultSeparatorInsets.right];
[_tableView setSeparatorInset:UIEdgeInsetsMake(0, left, 0, right)];
[[self tableView] setSeparatorInset:UIEdgeInsetsMake(0, left, 0, right)];
} else {
[_tableView setSeparatorInset:_defaultSeparatorInsets];
[[self tableView] setSeparatorInset:_defaultSeparatorInsets];
}
if (![searchController isActive]) {
[[self tableView] setNeedsDisplay];
}
}

-(void)setRowSeparatorInsets_:(id)arg
{
[self tableView];

if ([arg isKindOfClass:[NSDictionary class]]) {

CGFloat left = [TiUtils floatValue:@"left" properties:arg def:_defaultSeparatorInsets.left];
CGFloat right = [TiUtils floatValue:@"right" properties:arg def:_defaultSeparatorInsets.right];
_rowSeparatorInsets = UIEdgeInsetsMake(0, left, 0, right);
}
if (![searchController isActive]) {
[_tableView setNeedsDisplay];
[[self tableView] setNeedsDisplay];
}
}

Expand Down Expand Up @@ -1390,7 +1413,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
} else {
[cell setPosition:TiCellBackgroundViewPositionMiddle isGrouped:NO];
}


if (_rowSeparatorInsets.left != 0 || _rowSeparatorInsets.right != 0) {
[cell setSeparatorInset:_rowSeparatorInsets];
}
cell.dataItem = item;
cell.proxy.indexPath = realIndexPath;
return cell;
Expand Down