Fixes #1409. Fixed: broken tab view decoded from xib in certain situation.

Without this fix, a tab view set up in Xcode where a tab but the first was selected could be instantiated in a corrupted state in Cappuccino, where tab selection would have no effect.

This fix ensures that even if the decoded view of the selected tab view item has a superview different from how we do things in Cappuccino, we make sure to set it right.
This commit is contained in:
Alexander Ljungberg committed 2013-02-22 19:08:38 +00:00
1 parent 47ade360d5
commit a19ec35a47
1 file changed
+11
+11
View File
@@ -520,6 +520,17 @@ var CPTabViewItemsKey = "CPTabViewItemsKey",
return self;
}
- (void)awakeFromCib
{
// This is a quick and dirty fix of the tab view item we decode and install in _box
// having a different _superview decoded later in the decoding process - e.g. the
// CPTabView itself as is the case when we're coming from an xib. This solution could
// probably be improved by fixing this in nib2cib instead, but the _box doesn't yet
// exist then so it's not totally clear what to change the superview to at that stage.
if ([_box contentView])
_box._contentView._superview = _box;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];