From 2feeed4d4745c8ddb2c6007d9f9e113cddf7b550 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Tue, 26 May 2015 15:44:06 +0300 Subject: [PATCH] ListViewCell returned due to layout problems --- ui/list-view/list-view.ios.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ui/list-view/list-view.ios.ts b/ui/list-view/list-view.ios.ts index 99bf8cca9..9c66f83c8 100644 --- a/ui/list-view/list-view.ios.ts +++ b/ui/list-view/list-view.ios.ts @@ -19,6 +19,15 @@ require("utils/module-merge").merge(common, exports); var infinity = utils.layout.makeMeasureSpec(0, utils.layout.UNSPECIFIED); +class ListViewCell extends UITableViewCell { + static new(): ListViewCell { + return super.new(); + } + static class(): any { + return ListViewCell; + } +} + function notifyForItemAtIndex(listView: definition.ListView, cell: any, eventName: string, indexPath: NSIndexPath) { var args = { eventName: eventName, object: listView, index: indexPath.row, view: cell.view, ios: cell, android: undefined }; listView.notify(args); @@ -45,7 +54,7 @@ class DataSource extends NSObject implements UITableViewDataSource { public tableViewCellForRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): UITableViewCell { // We call this method because ...ForIndexPath calls tableViewHeightForRowAtIndexPath immediately (before we can prepare and measure it). - var cell = tableView.dequeueReusableCellWithIdentifier(CELLIDENTIFIER) || UITableViewCell.new(); + var cell = tableView.dequeueReusableCellWithIdentifier(CELLIDENTIFIER) || ListViewCell.new(); this._owner._prepareCell(cell, indexPath); var cellView: view.View = cell.view; @@ -106,7 +115,7 @@ class UITableViewDelegateImpl extends NSObject implements UITableViewDelegate { // in iOS 7.1 this method is called before tableViewCellForRowAtIndexPath so we need fake cell to measure its content. var cell = this._measureCell; if (!cell) { - this._measureCell = tableView.dequeueReusableCellWithIdentifier(CELLIDENTIFIER) || UITableViewCell.new(); + this._measureCell = tableView.dequeueReusableCellWithIdentifier(CELLIDENTIFIER) || ListViewCell.new(); cell = this._measureCell; } @@ -148,7 +157,7 @@ export class ListView extends common.ListView { super(); this._ios = new UITableView(); - this._ios.registerClassForCellReuseIdentifier(UITableViewCell.class(), CELLIDENTIFIER); + this._ios.registerClassForCellReuseIdentifier(ListViewCell.class(), CELLIDENTIFIER); this._ios.autoresizesSubviews = false; this._ios.autoresizingMask = UIViewAutoresizing.UIViewAutoresizingNone;