[MonoTouch] Still IntPtr Constructor issues
Rene Ruppert
rene.ruppert at googlemail.com
Wed Dec 7 15:20:45 EST 2011
Because Rolf and Sebastien said that if I add it I will hide the real issue of my problems.
However Miguel stated that the cause may be they missed to keep a reference somewhere.
So I don't really know whose fault it is but as the Xamaritans are so much smarte, I guess it's mine. :-)
Meanwhile I have added the constructor to the problematic UITableViewCell subclass and I can see that it calls:
SetSelect(), SetHighlighted() and LayoutSubviews() (in this order).
If I just return in case the cell was constructed from the IntPtr ctor eveything works like charm. The layout is correct, no crashes. But why the heck is it called in the first place? I'm sure it's no me who's calling it.
You can read into the Xamarin comments in these threads:
http://stackoverflow.com/q/8383461/304870
http://stackoverflow.com/q/8344613/304870
René
Am 07.12.2011 um 21:03 schrieb Rene Ruppert:
>
> And there's one more thing I would like to add: If I put a breakpoint in SetSelected() of the cell I can see that it is called constantly (even for cells constructed without using the IntPtr) but the interesting thing is that the call stack is always pretty small and does not show where the call is coming from.
> It contains these two lines and that's it:
>
> MonoTouch.UIKit.UIApplication.Main (args={string[0]}, principalClassName="UIApplicationMain", delegateClassName="AppDelegateIPad") in
>
> /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
> Browser.Application.Main (args={string[0]}) in /Users/Krumelur/Documents/Develop/.../Main.cs:15
>
> So something seems to trigger it magically.
>
> René
>
> Am 07.12.2011 um 20:55 schrieb Rene Ruppert:
>
>> Hi,
>>
>> I'm still struggling with the IntPtr Constructor issue I started on SO.
>> I got a bit further meanwhile.
>>
>> The case is: I'm subclassing UITableViewCell and do not provide the IntPtr:ctor.
>>
>> By adding the ctor and breaking in there I figured out what ObjC wants my class to do: it is calling void SetSelected ( bool selected, bool animated ).
>>
>> This means "something" wants to select my cell. I looked through my code and found exactly ONE place where I call SelectRow(). I commented that out and STILL it goes through the ctor and to SetSelected().
>>
>> What are my options now? Does UITableViewCell maybe always require the IntPtr ctor?
>> What could possibly still select a row in a UITableView besides SelectRow()?
>>
>> René
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20111207/9e0a1861/attachment.html
More information about the MonoTouch
mailing list