0

わかりました、私は困惑しています...不足しているコンセントに関連するすべての答えは、コンセントが接続されていることを確認することを指しています。であることを確認しました。以下のスクリーンショットで確認できます。問題は、コードが IOS5.0 で実行されることです。したがって、これは間違いなく互換性に関連する問題です。また、2つの回答で提案されていることも試しました。しかし、それは役に立ちません。

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;
}

ここに画像の説明を入力 ここに画像の説明を入力

4

2 に答える 2

0

このロジックをコードに追加してください。

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
   // Load resources for iOS 6.1 or earlier
} else {
   // Load resources for iOS 7 or later
}

そして、このドキュメントを注意深く読んでください。

于 2013-09-27T05:47:00.377 に答える
0

古い xib を新しい Xcode に移植してアップグレードするというさまざまな経験がありました。これらのインスタンスで私が行ったことは、新しい xib ファイルを作成し、古いものからコントロールをコピーして貼り付けるだけです。次に、スーパークラスを再割り当てし、デリゲートを再マップします。

もっと良い解決策があればいいのにと思いますが、これでうまくいきました。

また、以前の XCode プロジェクトで AutoLayout を使用していなかった場合は、Xcode 5 で少し異なることに注意してください。

于 2013-09-26T21:08:40.157 に答える