UIScrollView ContentSize崩溃了我的代码

时间:2012-09-21 08:07:01

标签: iphone xcode

我的应用中有这行代码:

NSLog(@"%f , %f",safeZoneTutorialView.frame.size.height,safeZoneListView.frame.size.height);
[safeZonesScrollView setContentSize:CGSizeMake(320, safeZoneTutorialView.frame.size.height + 30 + safeZoneListView.frame.size.height)];

输出日志为:

2012-09-21 09:44:52.148 Locator[22143:11603] 100.000000 , 231.250000
2012-09-21 09:44:54.176 Locator[22143:11603] -[userProfileSafeZones setContentSize:]:               unrecognized selector sent to instance 0x7bc1290
2012-09-21 09:44:54.176 Locator[22143:11603] *** Terminating app due to uncaught exception    'NSInvalidArgumentException', reason: '-[userProfileSafeZones setContentSize:]: unrecognized     selector sent to instance 0x7bc1290'
*** First throw call stack:
(0x15d2022 0x1056cd6 0x15d3cbd 0x1538ed0 0x1538cb2 0x1bdf7 0x1a8f6 0x15d3e99 0x1bc14e   0x1bc0e6 0x262ade 0x262fa7 0x262266 0x47da1a 0x15a699e 0x153d640 0x15094c6 0x1508d84 0x1508c9b 0x14bb7d8 0x14bb88a 0x1b9626 0x2252 0x21c5)
terminate called throwing an exception

我输错了命令吗?

这是此ScrollView数据的其余部分:

NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"userProfileSafeZones" owner:self options:nil];
safeZonesScrollView = [nibObjects objectAtIndex:0];
safeZonesScrollView.frame = CGRectMake(0,145,320,335);
safeZonesScrollView.alpha = 0;

而且我不确定我是否应该“分配初始化”这个滚动视图(如果我这样做会崩溃,如果我不崩溃它会崩溃)。

感谢。

0 个答案:

没有答案