Er, C icon because there's no Objective-C
http://stackoverflow.com/questions/2634488/uilabel-applying-cgaffinetransformmakerotation-causing-mysterious-crash
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!
objective-c interface-builder uilabel xcode iphone
edit|delete|flag
asked 1 hour ago
community wiki
quantumpotato
[this is a great comment]
[flag this comment as noise, offensive, or spam]
Your error message means that the error is somewhere in array's managing - there are an array with one element, and you are trying to use the second element (with index 1). That's why I think that you search an error in wrong place. Maybe, you have some arrays in your code? – kpower 53 mins ago
Thanks for the response. I do. I also have been adding the labels to the view as subviews - but why would .transform affect this? The labels aren't in any array except for the subview. Tried putting this code before I initialize the arrays, still crashing. Don't have any arrays with just 0 or 1 size.. seems to be a problem with the UILabel itself! – quantumpotato 1 min ago edit [delete this comment]
Help is much appreciated