Has anyone used MT.D MultilineEntryElement?

I am using the latest one created by Alxandr (Feb / 2012).

I am trying to add it to a section using the same method as adding an EntryElement. The MultilineEntryElement adds to the section, but the receiving cell will not be decrypted by default by default. Then MLEE will overwrite the section below. I would like it to have a screen width and a length of 10 lines by default. What's the best way to do this?

Thank! Matt

+3


source to share


2 answers


To solve this problem, set the RootElement property of UnevenRows to true, for example:



 var r = new RootElement ("foo") { ... }
 r.UnevenRows = true;

      

+3


source


I've done a little more research on this issue. Please note, I am using my own MultilineEntryElement implementation, which is probably slightly different from the others.

First, it's worth saying that the problem doesn't show up for me in "simple" scenarios - where the MultilineEntryElement is placed inside a section that is created as part of the initial creation of the RootElement. The problem only occurs when manipulating an existing RootElement that has already been handled by the DialogViewController.

It looks like a bug in MonoTouch.Dialog's way of calculating the size of strings. If the element implements IElementSizing, then MTD will call its GetHeight () overload. After MTD detects an element with an "irregular" height, it seems to have to call this method every time it processes a change in the enclosing section. This can be costly ... So, if MT.D throws a RootElement and doesn't find an element that implements IElementSizing, it seems like (maybe it's meant to be optimized?) The MTD will IGNORE IElementSize for any elements that are added to the initial POST rendering ... Thus, the CELL RowHeight property will return the standard row height, and the MultilineEntryElement will display the UITextView, which will spill over the cells below.



The workaround I came up with is to create a simple DummyElement that implements IElementSizing and returns 0 for GetHeight (), and add it to the original RootElement before the initial layout happens. If you do this, MTD will register the element that has an irregular height and call the GetHeight () method on the MultilineEntryElement when you later add it to your DOM element.

Here is my minimal DummyElement meaning if it helps:

public class DummyElement : Element, IElementSizing 
{    
    public DummyElement() : base ("empty")
    {
    }   

    public float GetHeight (UITableView tableView, NSIndexPath indexPath)
    {
        return 0;
    }
}

      

0


source







All Articles