Remove listview cell selection in iOS

This commit is contained in:
Kamen Velikov
2015-11-24 10:52:47 +02:00
parent 4cf21ba489
commit f6958d9b22
2 changed files with 28 additions and 4 deletions

View File

@ -161,6 +161,26 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
}
}
public test_cell_selection_ios() {
if (platform.device.os === platform.platformNames.ios) {
let listView = this.testView;
let colors = ["red", "green", "blue"];
listView.items = colors;
TKUnit.waitUntilReady(() => { return this.getNativeViewCount(listView) === listView.items.length; }, ASYNC);
var index = 1;
this.performNativeItemTap(listView, index);
var uiTableView = <UITableView>listView.ios;
var cellIndexPath = NSIndexPath.indexPathForItemInSection(index, 0);
var cell = uiTableView.cellForRowAtIndexPath(cellIndexPath);
uiTableView.selectRowAtIndexPathAnimatedScrollPosition(cellIndexPath, false, 0);
TKUnit.assertTrue(cell.selected, "cell is selected");
}
}
public test_set_items_to_array_creates_native_views() {
var listView = this.testView;
listView.on(listViewModule.ListView.itemLoadingEvent, this.loadViewWithItemNumber);
@ -482,7 +502,7 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
TKUnit.assertEqual(secondNativeElementText, "2", "second element text");
TKUnit.assertEqual(thirdNativeElementText, "3", "third element text");
}
public test_ItemTemplateFactoryFunction() {
var listView = this.testView;

View File

@ -103,7 +103,12 @@ class UITableViewDelegateImpl extends NSObject implements UITableViewDelegate {
if (owner) {
notifyForItemAtIndex(owner, cell, cell.view, ITEMTAP, indexPath);
}
cell.highlighted = false;
return indexPath;
}
public tableViewDidSelectRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): NSIndexPath {
tableView.deselectRowAtIndexPathAnimated(indexPath, true);
return indexPath;
}
@ -157,8 +162,7 @@ class UITableViewRowHeightDelegateImpl extends NSObject implements UITableViewDe
if (owner) {
notifyForItemAtIndex(owner, cell, cell.view, ITEMTAP, indexPath);
}
cell.highlighted = false;
return indexPath;
return indexPath;
}
public tableViewHeightForRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): number {