MonoMobile.Views.ViewSource.NewCell C# (CSharp) Method

NewCell() protected method

protected NewCell ( NSString cellId, NSIndexPath indexPath ) : UITableViewCell
cellId NSString
indexPath NSIndexPath
return UITableViewCell
		protected override UITableViewCell NewCell(NSString cellId, NSIndexPath indexPath)
		{
			var id = cellId;
	
			var memberData = GetMemberData(indexPath);
			if (memberData != null)
			{
				id = memberData.Id;
			}

			var section = Sections[indexPath.Section];
			var listSource = GetListSource(indexPath);

			if ((typeof(IEnumerable).IsAssignableFrom(memberData.Type) || typeof(Enum).IsAssignableFrom(memberData.Type)) && listSource != null && !listSource.IsRootCell) 
			{
				id = listSource.CellId;
			}

			if (memberData != null)
			{
				var viewType = ViewContainer.GetView(memberData);
				if (viewType != null)
				{					
					var key = id.ToString();

					if (section.ViewTypes.ContainsKey(key))
					{
						var viewTypeList = section.ViewTypes[key];

						if (viewTypeList == null)
						{
							viewTypeList = new List<Type>();
							section.ViewTypes[key] = viewTypeList;

							if (!viewTypeList.Contains(viewType))
							{
								viewTypeList.Add(viewType);
							}
						}
					}
					else
						section.ViewTypes.Add(key, new List<Type>() { viewType });
				}
			}

			return base.NewCell(id, indexPath);
		}