I've narrowed this down to the bit of code I thought I needn't post.
TranslationsView is basically just a CPView with rows of CPTextField
instances inside it.
If I remove this component from the UI everything works as normal. How
weird. Here's where somebody questions whether or not I was on drugs
when I wrote this code :P
It basically goes:
for each newWords
create a new CPTextField with a frame offset by the line height of
the font
if I already have a subview where this will go, replace it
else add a new subview
then remove any additional subviews
/*
* LBATranslationsView.j
*
* Copyright 2009, Chris Corbyn All rights reserved.
*/
@import <Foundation/CPArray.j>
@import <Foundation/CPString.j>
@import <AppKit/CPView.j>
@implementation LBATranslationsView : CPView
{
CPArray words @accessors;
int fontSize @accessors;
}
- (void)setWords:(CPArray)newWords
{
words = newWords;
var subviewsLen = [[self subviews] count];
for (var i = 0, len = [[newWords] count]; i < len; ++i)
{
var label = [[CPTextField alloc] initWithFrame:CPRectMake(0,
fontSize * i * 1.2, CPRectGetWidth([self bounds]), CPRectGetHeight
([self bounds]))];
[label setAutoresizingMask:CPViewWidthSizable |
CPViewHeightSizable];
[label setAlignment:CPCenterTextAlignment];
[label setFont:[CPFont systemFontOfSize:fontSize]];
[label setObjectValue:[newWords objectAtIndex:i]];
if (i < subviewsLen)
{
var oldLabel = [[self subviews] objectAtIndex:i];
[self replaceSubview:oldLabel with:label];
}
else
{
[self addSubview:label];
}
}
for (var i = [newWords len]; i < subviewsLen; ++i)
{
[[[self subviews] objectAtIndex:i] removeFromSuperview];
}
}
@end
On 14 Nov, 15:36, Chris Corbyn <
ch...@w3style.co.uk> wrote:
> Ok, turns out I have the latest version from github:
>
> commit 95c340164097a83417350458373920fcca896f67
> Author: Ross Boucher <
r...@280north.com>