ios - Custom EntryElement alignment changes on redraw / refresh -



ios - Custom EntryElement alignment changes on redraw / refresh -

i've created custom entryelement our monotouch.dialog controls aligned right. code follows:

public class rightalignentryelement : entryelement { private nsstring _cellkey = new nsstring("rightalignedentryelement"); public rightalignentryelement(string caption, string placeholder, string value) : base(caption, placeholder, value) { } protected override uitextfield createtextfield(rectanglef frame) { var paddedframe = frame; paddedframe.width = frame.width -= 10; var textfield = base.createtextfield(paddedframe); textfield.textalignment = uitextalignment.right; homecoming textfield; } public override uitableviewcell getcell(uitableview tv) { var cell = base.getcell(tv); homecoming cell; } protected override nsstring cellkey { { homecoming _cellkey; } } }

this works fine, until dialog gets refreshed, illustration table scrolled, or subview presented dismissed.

before there padding on right of cell, , 1 time scrolled padding disappears. i've seen has been problem past, , have seen various other suggestions on here , xamarin forums, nil seems work me.

see attached screen grabs before , after.

for record, here response got on forum question:

the behaviour due not using cell reuse in rightalignentryelement

your getcell method should like:

public override uitableviewcell getcell(uitableview tv) { var cell = tv.dequeuereusablecell (cellkey) uitableviewcell; if (cell == null) { cell = base.getcell(tv); cell.textlabel.font = uifont.fromname("helveticaneue-light", 16); } homecoming cell; }

ios monotouch xamarin monotouch.dialog

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -