Re: [MonoTouch] Dequeuing table cells?
public class SubtitleTableViewCell : UITableViewCell { public SubtitleTableViewCell () : this ( typeof ( SubtitleTableViewCell ). FullName ) { } public SubtitleTableViewCell ( string reuseIdentifier ) : base ( UITableViewCellStyle.Subtitle, reuseIdentifier ) { } protected SubtitleTableViewCell ( IntPtr handle ) : base ( handle ) { } } If I use a class like this then I get a cell of the default style. If I don't pass the pointer to base ( handle ) then it uses the subtitle style. On Wed, Jan 14, 2015 at 12:55 PM, Rolf Bjarne Kvinge r...@xamarin.com wrote: Hi, You should chain to the corresponding base constructor like this: public MyTableViewCell (IntPtr handle) : base (handle) { ... } if that doesn't work, something else is going wrong. Can you show your MyTableViewCell code? Rolf On Wed, Jan 14, 2015 at 6:16 PM, Michael McGlothlin mike.mcgloth...@gmail.com wrote: In experimenting it seems you need an actual subclass to set the cell style as you never manually call the cell constructor and there is no other way to choose the style. If I pass the handle to base ( handle ) it appears that the default constructor, that configures the style and reuse identifier by passing these to base ( style, reuseIdentifier ), never gets called? I probably won't actually use the styles anyway but it doesn't seem to work as I'd expect. Mostly trying to get a clearer picture of what is going on. Since starting transitioning to Universal I've noticed several behaviors that seem odd. Trying to determine if I'm doing something new, if things changed, or if they're bugs. I noticed yesterday that it is now ok for that special constructor to be protected instead of public. It didn't work on one computer but did on the other .. after the second finished updating Xamarin Studio then it worked on both. So I guess it's actively being worked on? Thanks, Michael McGlothlin Sent from my iPhone On Jan 14, 2015, at 10:49 AM, Jeff Stedfast j...@xamarin.com wrote: Hi Michael, Hopefully one of the Xamarin.iOS devs can chime in, but the IntPtr handle that is passed to .ctors is the native object pointer. If you don't pass it to base, then what happens is that the Xamarin.iOS runtime creates a new native instance. My understanding is that you have this: public MyTableViewCell (IntPtr handle) : base (handle) { ... } and that you are removing the call to base()... You shouldn't be doing that afaik. This .ctor is meant only to be used by the runtime itself and should not be invoked by your code (it doesn't sound like you are invoking it yourself, but just in case that wasn't obvious). I'm not sure if that really helps answer your overall question, but hopefully it at least helps clarify things a little bit for you. Jeff On Wed, Jan 14, 2015 at 11:40 AM, Michael McGlothlin mike.mcgloth...@gmail.com wrote: It appears that custom UITableViewCells must have a constructor that takes IntPtr for the automatic reuse to work but I can't see anywhere that says what this pointer is? It seems if I pass the pointer to the base that the cell doesn't work right but if I ignore the pointer it does work right? Thanks, Michael McGlothlin Sent from my iPhone ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch
Re: [MonoTouch] Dequeuing table cells?
Hi, You should chain to the corresponding base constructor like this: public MyTableViewCell (IntPtr handle) : base (handle) { ... } if that doesn't work, something else is going wrong. Can you show your MyTableViewCell code? Rolf On Wed, Jan 14, 2015 at 6:16 PM, Michael McGlothlin mike.mcgloth...@gmail.com wrote: In experimenting it seems you need an actual subclass to set the cell style as you never manually call the cell constructor and there is no other way to choose the style. If I pass the handle to base ( handle ) it appears that the default constructor, that configures the style and reuse identifier by passing these to base ( style, reuseIdentifier ), never gets called? I probably won't actually use the styles anyway but it doesn't seem to work as I'd expect. Mostly trying to get a clearer picture of what is going on. Since starting transitioning to Universal I've noticed several behaviors that seem odd. Trying to determine if I'm doing something new, if things changed, or if they're bugs. I noticed yesterday that it is now ok for that special constructor to be protected instead of public. It didn't work on one computer but did on the other .. after the second finished updating Xamarin Studio then it worked on both. So I guess it's actively being worked on? Thanks, Michael McGlothlin Sent from my iPhone On Jan 14, 2015, at 10:49 AM, Jeff Stedfast j...@xamarin.com wrote: Hi Michael, Hopefully one of the Xamarin.iOS devs can chime in, but the IntPtr handle that is passed to .ctors is the native object pointer. If you don't pass it to base, then what happens is that the Xamarin.iOS runtime creates a new native instance. My understanding is that you have this: public MyTableViewCell (IntPtr handle) : base (handle) { ... } and that you are removing the call to base()... You shouldn't be doing that afaik. This .ctor is meant only to be used by the runtime itself and should not be invoked by your code (it doesn't sound like you are invoking it yourself, but just in case that wasn't obvious). I'm not sure if that really helps answer your overall question, but hopefully it at least helps clarify things a little bit for you. Jeff On Wed, Jan 14, 2015 at 11:40 AM, Michael McGlothlin mike.mcgloth...@gmail.com wrote: It appears that custom UITableViewCells must have a constructor that takes IntPtr for the automatic reuse to work but I can't see anywhere that says what this pointer is? It seems if I pass the pointer to the base that the cell doesn't work right but if I ignore the pointer it does work right? Thanks, Michael McGlothlin Sent from my iPhone ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch
[MonoTouch] Dequeuing table cells?
It appears that custom UITableViewCells must have a constructor that takes IntPtr for the automatic reuse to work but I can't see anywhere that says what this pointer is? It seems if I pass the pointer to the base that the cell doesn't work right but if I ignore the pointer it does work right? Thanks, Michael McGlothlin Sent from my iPhone ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch
Re: [MonoTouch] Dequeuing table cells?
In experimenting it seems you need an actual subclass to set the cell style as you never manually call the cell constructor and there is no other way to choose the style. If I pass the handle to base ( handle ) it appears that the default constructor, that configures the style and reuse identifier by passing these to base ( style, reuseIdentifier ), never gets called? I probably won't actually use the styles anyway but it doesn't seem to work as I'd expect. Mostly trying to get a clearer picture of what is going on. Since starting transitioning to Universal I've noticed several behaviors that seem odd. Trying to determine if I'm doing something new, if things changed, or if they're bugs. I noticed yesterday that it is now ok for that special constructor to be protected instead of public. It didn't work on one computer but did on the other .. after the second finished updating Xamarin Studio then it worked on both. So I guess it's actively being worked on? Thanks, Michael McGlothlin Sent from my iPhone On Jan 14, 2015, at 10:49 AM, Jeff Stedfast j...@xamarin.com wrote: Hi Michael, Hopefully one of the Xamarin.iOS devs can chime in, but the IntPtr handle that is passed to .ctors is the native object pointer. If you don't pass it to base, then what happens is that the Xamarin.iOS runtime creates a new native instance. My understanding is that you have this: public MyTableViewCell (IntPtr handle) : base (handle) { ... } and that you are removing the call to base()... You shouldn't be doing that afaik. This .ctor is meant only to be used by the runtime itself and should not be invoked by your code (it doesn't sound like you are invoking it yourself, but just in case that wasn't obvious). I'm not sure if that really helps answer your overall question, but hopefully it at least helps clarify things a little bit for you. Jeff On Wed, Jan 14, 2015 at 11:40 AM, Michael McGlothlin mike.mcgloth...@gmail.com wrote: It appears that custom UITableViewCells must have a constructor that takes IntPtr for the automatic reuse to work but I can't see anywhere that says what this pointer is? It seems if I pass the pointer to the base that the cell doesn't work right but if I ignore the pointer it does work right? Thanks, Michael McGlothlin Sent from my iPhone ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch
Re: [MonoTouch] Dequeuing table cells?
Hi Michael, Hopefully one of the Xamarin.iOS devs can chime in, but the IntPtr handle that is passed to .ctors is the native object pointer. If you don't pass it to base, then what happens is that the Xamarin.iOS runtime creates a new native instance. My understanding is that you have this: public MyTableViewCell (IntPtr handle) : base (handle) { ... } and that you are removing the call to base()... You shouldn't be doing that afaik. This .ctor is meant only to be used by the runtime itself and should not be invoked by your code (it doesn't sound like you are invoking it yourself, but just in case that wasn't obvious). I'm not sure if that really helps answer your overall question, but hopefully it at least helps clarify things a little bit for you. Jeff On Wed, Jan 14, 2015 at 11:40 AM, Michael McGlothlin mike.mcgloth...@gmail.com wrote: It appears that custom UITableViewCells must have a constructor that takes IntPtr for the automatic reuse to work but I can't see anywhere that says what this pointer is? It seems if I pass the pointer to the base that the cell doesn't work right but if I ignore the pointer it does work right? Thanks, Michael McGlothlin Sent from my iPhone ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch ___ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch