在UIApplication中是否有像beginIgnoringInteractionEvents这样的函数忽略旋转而不是触摸?我需要我的应用程序不要只在MPMovePlayerViewController我出现的那个旋转.
谢谢
[UPDATE]
这是我的代码 -
MPMoviePlayerViewController *mpViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:videoURL]];
[mpViewController shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
[self presentMoviePlayerViewControllerAnimated:mpViewController];
[mpViewController release];
Run Code Online (Sandbox Code Playgroud)
我通过添加shouldAutorotateToInterfaceOrientation:和setStatusBarOrientation:方法来实现它.它适用于模拟器.但是,如果我在播放视频时旋转iPhone,状态栏也会旋转并保持纵向"卡住"状态.
我的问题的图像在http://i28.tinypic.com/357mrub.png
[更新2]
通过继承MPMoviePlayerViewController(并实现shouldAutorotate方法),程序将按原样旋转.只有视频无法播放,因为该行
[self presentMoviePlayerViewControllerAnimated:mpViewController];
Run Code Online (Sandbox Code Playgroud)
不接受我的子类.
"警告:不兼容的Objective-C类型'struct NoRotate*',预期'struct MPMoviePlayerViewController*'在传递'presentMoviePlayerViewControllerAnimated:'的参数1时从不同的Objective-C类型"
我的iPhone应用程序启动非常缓慢,我不知道为什么.我application:didFinishLaunchingWithOptions:不是很重,我只是为我的标签栏控制器的五个视图控制器中的每一个设置managedObjectContext.
有人知道导致发射缓慢的原因吗?谢谢.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
mathRootViewController.managedObjectContext = self.managedObjectContext;
favoriteRootViewController.managedObjectContext = self.managedObjectContext;
chemistryRootViewController.managedObjectContext = self.managedObjectContext;
physicsRootViewController.managedObjectContext = self.managedObjectContext;
shareRootViewController.managedObjectContext = self.managedObjectContext;
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
return YES;
}
Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,我想在服务器路径上直接保存图像.我正在使用下面的代码,但它没有在该路径上保存图像.来自服务器的响应是NUll而不是服务器路径中的savig映像
NSData *imageData = UIImageJPEGRepresentation(image, 90);
// setting up the URL to post to
NSString *urlString = @"http://192.0.168.109/Mobile_tutor/webservice/images/questions/";
// setting up the request object now
request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
/*
add some header info now
we always need a boundary when we post a file
also we need to set the content type
You might want to generate a random boundary.. this is just the same
as my output from wireshark on a valid …Run Code Online (Sandbox Code Playgroud) 我有一个按钮,现在可以打开邮件应用程序并通过我设置的属性添加联系人。我如何才能通过属性添加主题行?
- (IBAction)tourButton:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@", self.displayEmail]]];
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试合并在一定时间间隔后触发的本地通知,但是,在使用模拟器进行测试时,我似乎无法在任何时候显示通知.
我只是想在创建后10秒显示本地通知,但是,当在模拟器中运行应用程序时,无论应用程序是在前台还是后台,都不会显示任何内容.
我错过了什么吗?这可能与时区有关吗?
//通知设置
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:10];
localNotification.alertBody = @"Testing";
localNotification.alertAction = @"Show me the item";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
Run Code Online (Sandbox Code Playgroud)
//这是我的app委托中的didReceiveLocalNotification
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Reminder" message:notification.alertBody delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
Run Code Online (Sandbox Code Playgroud) timezone uiapplication ios uilocalnotification ios-simulator
我需要一些帮助.我希望我的应用程序运行时没有状态栏.
[[UIApplication sharedApplication] setStatusBarHidden:YES];
我将此行放入appDelegate中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
也许存在更好的地方?
我在我的应用程序中多次使用以下代码(特别是管理NavigationController):
MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
Run Code Online (Sandbox Code Playgroud)
我应该什么时候发布它?
感谢帮助,
斯特凡
请帮我.我有一个具有密码锁定功能的应用程序,每次用户打开应用程序时都会激活此功能.如果用户回家(应用程序转到后台),然后返回应用程序(前台),我想再次显示锁定屏幕(或使用其他视图控制器).我怎么会这样做?
我知道appDelegate中的WillEnterForeground,我只是无法弄清楚如何告诉我的应用程序呈现锁定屏幕而不是它在进入后台之前的屏幕.
此应用程序与照片库应用程序非常相似.使用锁定屏幕保护照片,每次打开应用程序时,用户都会被问到密码
非常感谢你提前
我正在尝试为应用程序图标添加徽章,但根本没有任何反应.
UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, categories: nil))
UIApplication.sharedApplication().applicationIconBadgeNumber = 40;
Run Code Online (Sandbox Code Playgroud)
我在这段代码中遗漏了什么吗?