UILabel applying CGAffineTransformMakeRotation causing mysterious crash
Posted
by quantumpotato
on Stack Overflow
See other posts from Stack Overflow
or by quantumpotato
Published on 2010-04-14T02:22:11Z
Indexed on
2010/04/14
2:33 UTC
Read the original article
Hit count: 407
In
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil parentController:(GameViewController *)myGameController{
Have a series of transforming labels like so:
deg90 = 1.570796326794897;
//....transforms background.center = CGPointMake(160,230); background.transform = CGAffineTransformMakeRotation(deg90);
BetLabel.text = @"test";
BetLabel.transform = CGAffineTransformMakeRotation(deg90);
That last line is crashing me with:
2010-04-13 21:04:47.858 Game[1204:207] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (1) beyond bounds (1)' 2010-04-13 21:04:47.893 Game[1204:207] Stack: ( 864992541, 859229716, (lots of numbers)
But if I comment it out, I get the text changing fine. Uh oh, just did a test.. turns out the other transforms were on UIImageViews. Apparently rotating a label in this xib is causing the crash.
But in another file the transforms are working fine:
newprofileentry.transform = CGAffineTransformMakeRotation(1.570796326794897);
playerb0.transform = CGAffineTransformMakeRotation(1.570796326794897);
playerb1.transform = CGAffineTransformMakeRotation(1.570796326794897);
Tried substituting deg90 with the full float value, still the same crash.
Tried cleaning cache, restarting IB and Xcode, cleaning all targets. Program has been running fine until I just added these labels. Tried deleting the label, readding and reconnecting the Outlet, too.
Thanks for reading, hope someone has an idea about this.
Cheers!
© Stack Overflow or respective owner