0

I have an app that has been working just fine for ages. I upgraded XCode and now 1 of my views is doing weird things.

None of the objects I attempt to add to the UIScrollview show up.

I have 2 screens that are basically identical in code (i literally copy and pasted). One of them works just fine, I click a button to move to the other screen, and it doesn't display ANY components I attempt to add to the scroll view.

Any ideas as to what could be wrong? Why it would suddenly stop adding components after upgrading Xcode?

I have a background image that I have tested and changed to self.view that changes just fine. But anything I try to add to my UIScrollView, nothing gets added. Some sample code...

my .h declaration

@interface OutgateInputViewController : UIViewController<UITextFieldDelegate,UIPickerViewDelegate>{
IBOutlet UIScrollView *outputsView;

a sample in my .m

UIGraphicsBeginImageContext(self.view.frame.size);
[[UIImage imageNamed:@"inputbackground.png"] drawInRect:self.view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

self.view.backgroundColor = [UIColor colorWithPatternImage:image];


int x = 20;
int y = 20;

CGRect myImageRect = CGRectMake(0, 15, 320, 32.5);
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
NSString *imgName = @"screen_logo.png";
[myImage setImage:[UIImage imageNamed:imgName]];
[outputsView addSubview:myImage];
y = y + 30;

pretty standard stuff. its an EXACT copy up to this point of the screen that works. (even a copy long after, i just pull data from a different location). So any ideas on what changed?

GingerHead
  • 8,130
  • 15
  • 59
  • 93
JMD
  • 1,540
  • 2
  • 24
  • 56
  • What does `NSLog(@"Super: %@, Sub: %@", outputsView, myImage);` display if you add it before the `addSubview:`? – Phillip Mills Oct 12 '12 at 14:41
  • Well, upon further investigation it seems this view just got all jacked up. Anything added through the drag and drop menu in storyboard is broke entirely. I re-edited my code to add the UIScrollView programmatically and it worked fine. Apparently anything added in the drag drop is completely unresponsive. I have a title bar with 2 buttons and they look like they are in a 'locked' mode. Pressing them does utterly nothing(they don't even animate like you did press the button. looks as if the screen is frozen) – JMD Oct 12 '12 at 14:50

1 Answers1

0

I went back and re-did everything from scratch, and apparently for some reason THIS View needs the additional __weak at the start of the declaration in the .h ...

no idea why as of yet, but this solved the issue of the entire view being broken.

__weak IBOutlet UIScrollView *outputsView;
JMD
  • 1,540
  • 2
  • 24
  • 56