简体   繁体   中英

Background image shows up on simulator but not device?

I'm working on an IOS app and my background image shows up perfectly on the iPad simulator, but not on the actual device? Is there a reason for this??

This is my code:

    if (IsPad) {
        SKSpriteNode *bg = [SKSpriteNode spriteNodeWithImageNamed:@"padBG"];
        bg.position = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
        bg.zPosition = -3.0;
        [self addChild:bg];
    }else {
        SKSpriteNode *bg1 = [SKSpriteNode spriteNodeWithImageNamed:@"iphoneBG"];
        bg1.position = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
        bg1.zPosition = -3.0;
        [self addChild:bg1];
    }

Is there any reason why the image is not showing up on the actual device? The image has been properly imported into my project as padBG@2x.png, and IsPad is defined in my pch as:

#define IsPad      (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone)

Thanks in advance.

尝试在imageNamed:@“ padBG.png”; p之后添加.png或.jpg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM