From a19ec35a473fc69403929a9a34f3f8cf75b92cde Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Fri, 22 Feb 2013 19:08:38 +0000 Subject: [PATCH] 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. --- AppKit/CPTabView.j | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AppKit/CPTabView.j b/AppKit/CPTabView.j index a5fc880b5..7d9d943fe 100644 --- a/AppKit/CPTabView.j +++ b/AppKit/CPTabView.j @@ -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];