Tag: ios7

找出Music.app中正在播放的歌曲

在iOS上,我的应用程序是否有一种方法可以找出当前在“音乐”应用程序中正在播放的歌曲? 例如,如果他们在使用我的应用程序时在后台播放歌曲,我可以获取有关该歌曲的信息吗? 如果可以的话,有没有办法让我的应用程序在新歌开始播放时收到某种通知? 谢谢!

如何通过编程方式将PDF分割成独立的单页PDF格式

要求是将PDF分成单独的页面,只保留单个文件为.pdf扩展名。 在/ CreatedPDF文件夹中创build的文件不会被打开 请帮忙解决/纠正这个问题。 //"fileURL" is the original File which has to be broken //"pages" is the number of pages in PDF NSInteger pages = CGPDFDocumentGetNumberOfPages(pdfDocReference); for (int page = 1; page <= pages; page++) { NSFileManager *fm = [NSFileManager defaultManager]; NSString *dirName = [documentsDirectory stringByAppendingPathComponent:@"/CreatedPDF"]; [fm createDirectoryAtPath:dirName withIntermediateDirectories:YES attributes:nil error:nil]; NSString *pdfPath = [dirName […]

boundingRectWithSize的怪异行为:options:attributes:context:

我遇到一个与boundingRectWithSize:options:attributes:context:相关的奇怪问题boundingRectWithSize:options:attributes:context: 这是代码 NSString *text = @"These long strings work"; CGSize maxSize = CGSizeMake(176.0f, MAXFLOAT); CGRect rect = [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:16.0]} context:nil]; CGSize size = rect.size; 我有一个使用此代码的Xcode iOS项目。 当我运行这个项目时, size是(width=149.8125, height=18.1796875) 我在xcode中创build了一个新的单页应用程序项目,并在那里testing了相同的代码。 size是(width=172.944031, height=19.0880013) (它与在界面生成器中使用相同标题和相同字体创build的UILabel的帧大小相匹配) 苹果文档boundingRectWithSize:options:attributes:context : Calculates and returns the bounding rect for the receiver drawn using the given options and display […]

如何在ios7的后台运行进程

我想继续在前台和后台运行我的进程。我已经实现了以下代码 self.updateTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(repeatedMethod) userInfo:nil repeats:YES]; self.backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ NSLog(@"Background handler called. Not running background tasks anymore."); [[UIApplication sharedApplication] endBackgroundTask:self.backgroundTask]; self.backgroundTask = UIBackgroundTaskInvalid; }]; 在前台很好,但在后台进程只运行了5分钟,并没有超过这个运行。但我希望它连续运行,即使在后台也。请帮助。

由于iOS 7,视图不会出现

我用iOS 7在iPhone上尝试了我的应用程序,除了一件事以外,一切正常。 在iOS 6版本中,当我执行下面的代码时,加载视图(带有activityindicator)在加载结束时出现并消失。 在iOS 7上,视图在加载过程中完全不显示。 self.loadingView.alpha = 1.0; [self performSelector:@selector(accessServices) withObject:nil afterDelay:0.0f]; AccessServices方法: – (void)accessServices { // Getting JSON stuff // The code is OK, I just don't copy/paste it here self.loadingView.alpha = 0.0; } 怎么了 ? 这是一个iOS 7的错误?

使用animation以编程方式更改tabbarController的选项卡

我想通过animation代码更改选项卡。 确切的情况是,有2个选项卡与下面的层次结构。 First tab – Navigation controller – Login controller – Some other controller Second tab – Navigation controller – Screen with Logout button 现在,如果用户按下注销,我需要显示login屏幕。 为此,我需要将标签切换到FirstTab ,然后popToRootViewController。 所以我在做什么是在退出button按我发送NSNotification到LoginController ,然后执行下面的方法。 – (void)logoutButtonPressed { // Go to root controller in navigation controller of first tab. [self.navigationController popToRootViewControllerAnimated:YES]; // Change tab to "First tab". This happens sharply without […]

现在提交iOS 7应用程序?

现在GM已经出来了,我们可以把iOS 7编译好的Binary只发送给App Store吗? 还是要等到9月18日? 看来Review需要应用程序才能运行iOS 7,所以我在这里还挺不错的。 花了他们两周的时间才告诉我这是奇怪的,因为到目前为止,iOS 7仍然处于testing阶段。 虽然iOS 6.1.3是唯一的官方iOS atm,但我仍然试图与他们沟通。 这是另一个等待游戏,还是我可以build立反对通用汽车发布,并尝试再次提交? 从我的回忆中,应该是允许提交的最终版本,是正确的? 谢谢!

如何在iOS 7的Web应用程序中设置状态栏的颜色?

在iOS 7中,很多应用程序正在改变状态栏的外观,而且显然有些事情已经改变为web应用程序的状态栏。 它看起来像networking应用程序开发人员将能够影响酒吧的颜色,但这并不容易。 我们怎样才能改变我们的networking应用程序中的状态栏颜色?

限制IOS中的应用程序function仅适用于Cell / WiFi数据。

我已经search了所有的StackOverFlow,但没有find任何答案如何使用必需的设备function或UIRequiresPersistentWiFi 。 如何在我的应用程序中设置值,以便该应用程序仅适用于iPhone中的蜂窝数据/ WiFi? 目前我已经根据iOSDeviceCompatibility在必需的设备能力数组中设置了stringWiFi属性。 这是正确的方法,还是应该将UIRequiresPersistentWiFi BOOL设置为YES ?

游戏中心与Sprite Kit整合?

我如何使用Game Center或GameKit框架与Sprite Kit Xcode模板? 在Sprite套件中,它使用场景; 但通常查看排行榜,例如你需要“presentModalViewController”,但在SKView中是不可能的。 我怎样才能在iOS 6中authentication玩家和所有其他有趣的东西。 提前致谢!