Objective c 无论发生什么情况,启动映像都无法正常工作
我正在尝试为我的应用程序设置启动映像,但是,无论我做什么,它都无法正常工作 我的应用程序是横向的(左或右),但我想我只是把一个肖像启动图像无论如何 仅当我选中“纵向”框并取消选中“部署信息”设置中的“横向左侧”和“横向右侧”框时,才会显示启动图像。显然,我不能这么做,因为这会把我的整个应用程序搞砸 我尝试更改shouldAutorotateToInterfaceOrientation:以在所有视图控制器中返回YES,但这不起作用 感谢您的帮助。谢谢Objective c 无论发生什么情况,启动映像都无法正常工作,objective-c,xcode,image,launch,Objective C,Xcode,Image,Launch,我正在尝试为我的应用程序设置启动映像,但是,无论我做什么,它都无法正常工作 我的应用程序是横向的(左或右),但我想我只是把一个肖像启动图像无论如何 仅当我选中“纵向”框并取消选中“部署信息”设置中的“横向左侧”和“横向右侧”框时,才会显示启动图像。显然,我不能这么做,因为这会把我的整个应用程序搞砸 我尝试更改shouldAutorotateToInterfaceOrientation:以在所有视图控制器中返回YES,但这不起作用 感谢您的帮助。谢谢 -Xerif我可能和你有同样的问题,不幸的是,
-Xerif我可能和你有同样的问题,不幸的是,我发现这是Xcode软件中的一个小故障/错误。我已经想出了代码,可以在横向模式下显示发射图像,而无需任何尺寸要求!如果你有任何问题,试着跟我联系并给我留言。以下是步骤:
#import <Foundation/Foundation.h>
@interface GameData : NSObject
@property (assign, nonatomic) int Mainint;
+(instancetype)sharedGameData;
@end
#import "GameData.h"
@implementation GameData
+ (instancetype)sharedGameData
{
static id sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
-(void)launchImage
{
[GameData sharedGameData].Mainint = [[NSUserDefaults standardUserDefaults] integerForKey:@"mainint"];
[[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"mainint"];
}
#import "GameData.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
[[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"mainint"]; //Add This
// Override point for customization after application launch.
return YES;
}
#import <UIKit/UIKit.h>
#import "GameData.h" //Add this
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *launchImage; //Add this
@property IBOutlet UILabel *seconds; //Add this
@property NSTimer *timer; //Add this
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize launchImage;
@synthesize timer;
@synthesize seconds;
- (void)viewDidLoad
{
[GameData sharedGameData].Mainint = [[NSUserDefaults standardUserDefaults] integerForKey:@"mainint"];
seconds.hidden = YES;
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countUp) userInfo:nil repeats:YES];
if ([GameData sharedGameData].Mainint > 3) {
launchImage.hidden = YES;
}
[self countUp];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)countUp
{
[GameData sharedGameData].Mainint += 1;
seconds.text = [NSString stringWithFormat:@"%i", [GameData sharedGameData].Mainint];
if ([GameData sharedGameData].Mainint == 3) {
launchImage.hidden = YES;
[GameData sharedGameData].Mainint = 4;
[[NSUserDefaults standardUserDefaults] setInteger:[GameData sharedGameData].Mainint forKey:@"mainint"];
}
}
你用的是iPhone还是iPad?什么Xcode版本?什么iOS SDK版本?该应用程序适用于iPhone。我已经用IOS模拟器和我的手机进行了测试。我正在运行xcode 5,我在网上搜索了一下如何获得我的IOS SDK版本,它说关于这个mac>更多信息>系统报告>软件>开发人员,这就是它所说的Erm-你能不能将你的图像旋转90度,然后添加为横向启动?我尝试过旋转它,但在横向启动中仍然不起作用。是否有一种方法可以将应用程序设置为纵向,然后在加载视图之前将其更改为横向?忘了提到这一点,当我旋转图像时,我得到一个错误,它应该是640x960,但它是960x640。