Hi

On 2012.12.10 04:20, Alejandro Vazquez wrote:
Hi,

I would like to know if there is a way to create a MTD custom entry element so I can have 2 entries in the same row.


Example of an element

---------------------------------------------------------
| Caption    (value)  |  Caption  (value) |
---------------------------------------------------------

Thanks and hope someone can help me.
Again. You'll need custom cell. We draw the cell in Interface builder

API for usage - 2 different UITableViewCell defined/drawn in xib[s]:
https://github.com/moljac/MonoTouch.Samples/blob/master/UITableViewCellCustomTestVersionInitial/DialogViewControllerDemoListViewCustomCell.cs

XIBs are in folder:
https://github.com/moljac/MonoTouch.Samples/tree/master/UITableViewCellCustomTestVersionInitial/ElementCustom

go ahead and draw UI (xib that You need) in Interface Builder.
Creation of Element
ElementDerivedCustomedc2=newElementDerivedCustom("YourXIBName");

Internals!
custom Element:
https://github.com/moljac/MonoTouch.Samples/blob/master/UITableViewCellCustomTestVersionInitial/ElementCustom/ElementDerivedCustom.cs

Besides GetCell - needed for Dialog Element[s], there is another method that loads UITableViewCell from xib:
Note some values are hard-coded (index of views -ValueAt)

public UITableViewCell CellFromXib (string file_name_xib, UITableView tv)
{
// allocate/load a cell from XIB
NSArray views = NSBundle.MainBundle.LoadNib (file_name_xib, tv, null);
UITableViewCell cc;
cc = Runtime.GetNSObject(views.ValueAt(0)) as UITableViewCell;
return cc;
} Note: we need few more properties to be more generic

 * for Memeory Management- reusing the cell in GetCell
   cell_custom=tv.DequeueReusableCell("UITableViewCellCustom") this
   string should match string in XIB! Snippet

   <string key="IBUIReuseIdentifier">UITableViewCellCustom</string>

Refernces: http://tirania.org/monomac/archive/2011/Jan-18.htmlhttp://www.alexyork.net/blog/2011/07/18/creating-custom-uitableviewcells-with-monotouch-the-correct-way/ <http://www.alexyork.net/blog/2011/07/18/creating-custom-uitableviewcells-with-monotouch-the-correct-way/>





_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch


--
Miljenko Cvjetko dipl.ing. ET
        Direktor/CEO
        Projektant rjes(enja/Solution Architect 
        Razvojni programer/Senior developer
        Voditelj projekta/Project Manager

IX juz(na obala 13
Kajzerica Zagreb
T: 385 1 7775555
M: 385 91 557 447 3
F: 385 1 7779556
e: [email protected]
w: http://holisticware.net

_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to