Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
[TextKitDemo] Fix ctor, we must use initWithCoder when loading from a…
Browse files Browse the repository at this point in the history
… storyboard

initWithCoder: is the designated initializer for views built from the storyboard
since we are not creating the Cell programatically by calling
RegisterClassForCell we must export initWithCoder: ctor to unmanaged world so
when it needs to create a new cell it calls into our managed initWithCoder:
and do the initialization we want.
  • Loading branch information
dalexsoto committed Jun 16, 2015
1 parent 3c1b7a4 commit 23ea01b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions TextKitDemo/TextKitDemo/CollectionViewCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ namespace TextKitDemo
public partial class CollectionViewCell : UICollectionViewCell
{
public CollectionViewCell (IntPtr handle) : base (handle)
{
Initialize ();
}

[Export ("initWithCoder:")]
public CollectionViewCell (NSCoder coder) : base (coder)
{
Initialize ();
}

void Initialize ()
{
BackgroundColor = UIColor.DarkGray;
Layer.CornerRadius = 5;
Expand Down

0 comments on commit 23ea01b

Please sign in to comment.