Skip to content

Commit

Permalink
Merge pull request #3314 from paulppn/fix/ios_simple_table_view
Browse files Browse the repository at this point in the history
Fixed the MvxSimpleTableViewSource; now can work with both storyboard and xib-cells
  • Loading branch information
martijn00 authored Mar 12, 2019
2 parents 32f1906 + 0efc6b3 commit 27d6579
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@ public MvxSimpleTableViewSource(IntPtr handle)
MvxLog.Instance.Warn("MvxSimpleTableViewSource IntPtr constructor used - we expect this only to be called during memory leak debugging - see https://github.com/MvvmCross/MvvmCross/pull/467");
}

public MvxSimpleTableViewSource(UITableView tableView, string cellIdentifier)
: base(tableView)
{
_cellIdentifier = new NSString(cellIdentifier);
tableView.RegisterNibForCellReuse(UINib.FromName(cellIdentifier, NSBundle.MainBundle), cellIdentifier);
}

public MvxSimpleTableViewSource(UITableView tableView, string nibName, string cellIdentifier = null,
NSBundle bundle = null)
NSBundle bundle = null, bool registerNibForCellReuse = true)
: base(tableView)
{
// if no cellIdentifier supplied, then use the nibName as cellId
cellIdentifier = cellIdentifier ?? nibName;
_cellIdentifier = new NSString(cellIdentifier);
tableView.RegisterNibForCellReuse(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier);

if (registerNibForCellReuse) {
tableView.RegisterNibForCellReuse(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier);
}
}

public MvxSimpleTableViewSource(UITableView tableView, Type cellType, string cellIdentifier = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@ public MvxSimpleTableViewSource(IntPtr handle)
MvxLog.Instance.Warn("MvxSimpleTableViewSource IntPtr constructor used - we expect this only to be called during memory leak debugging - see https://github.com/MvvmCross/MvvmCross/pull/467");
}

public MvxSimpleTableViewSource(UITableView tableView, string cellIdentifier)
: base(tableView)
{
_cellIdentifier = new NSString(cellIdentifier);
tableView.RegisterNibForCellReuse(UINib.FromName(cellIdentifier, NSBundle.MainBundle), cellIdentifier);
}

public MvxSimpleTableViewSource(UITableView tableView, string nibName, string cellIdentifier = null,
NSBundle bundle = null)
NSBundle bundle = null, bool registerNibForCellReuse = true)
: base(tableView)
{
// if no cellIdentifier supplied, then use the nibName as cellId
cellIdentifier = cellIdentifier ?? nibName;
_cellIdentifier = new NSString(cellIdentifier);
tableView.RegisterNibForCellReuse(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier);

if (registerNibForCellReuse) {
tableView.RegisterNibForCellReuse(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier);
}
}

public MvxSimpleTableViewSource(UITableView tableView, Type cellType, string cellIdentifier = null)
Expand Down

0 comments on commit 27d6579

Please sign in to comment.