好的,我很难过......所有与缺少插座相关的答案都指向确保插座已连接。我已经确定它是。您可以在下面的屏幕截图中看到它。问题是代码运行在IOS5.0。所以这绝对是一些与兼容性相关的问题。我也尝试了两个答案中的建议。但这无济于事。
这是调用 xib 的代码。有什么线索吗?感谢您的帮助。
- (id) initWithModuleDataDict:(id)dataObject andStepNumber:(int)stepNumber
{
if ((self = [super initWithNibName:@"PhoneContent" bundle:nil])) {
self.moduleData = (NSDictionary *)dataObject;
self.module = [self.moduleData objectForKey:kModuleClassKey];
numberOfSteps = [[self.module steps] count];
self.doShowMeasurementViews = self.module.doShowMeasurementViews;
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = NO;
self.automaticallyAdjustsScrollViewInsets = NO;
// view controllers are created lazily in the loadScrollViewWithPage: method...
// in the meantime, load the array with placeholders which will be replaced on demand
NSMutableArray *controllers = [[NSMutableArray alloc] init];
for (unsigned i = 0; i < numberOfSteps; i++)
{
[controllers addObject:[NSNull null]];
}
self.viewControllers = controllers;
// CGRect fullScreenRect = [[UIScreen mainScreen] applicationFrame];
CGRect fullScreenRect = CGRectMake(0, 0, 320, 372);
UIScrollView *theScrollView = [[UIScrollView alloc] initWithFrame:fullScreenRect];
self.scrollView = theScrollView;
[theScrollView release];
CGRect bottomRect = CGRectMake(0, 410, 320, 20);
UIPageControl *thePageControl = [[UIPageControl alloc] initWithFrame:bottomRect];
thePageControl.center = CGPointMake(160.0, 400.0);
self.pageControl = thePageControl;
[thePageControl release];
// a page is the width of the scroll view
scrollView.pagingEnabled = YES;
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * numberOfSteps, scrollView.frame.size.height);
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.scrollsToTop = NO;
scrollView.delegate = self;
scrollView.decelerationRate = UIScrollViewDecelerationRateFast; //shp
pageControl.numberOfPages = numberOfSteps;
pageControl.currentPage = stepNumber;
// Create the transition sound
// Create the url for the source audio file (URLForResource:withExtension: method is new in 4.0)
NSURL *purrSound = [[NSBundle mainBundle]URLForResource:@"purr"
withExtension:@"aiff"];
// Store the url as a CFURLRef instance
self.soundFileURLRef = (CFURLRef)[purrSound retain];
// Create a system sound object representing the sound file
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundFileObject);
[controllers release];
}
return self;
}