Tag: ipad

从块返回UIImage

我有以下代码: – (UIImage *) getPublisherLogo { //check the cache if the logo already exists NSString * imageUrl = [NSString stringWithFormat:@"%@/%@&image_type=icon", self.baseUrl, self.imageUrl_]; ASIHTTPRequest * imageRequest = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:imageUrl]]; [imageRequest setTimeOutSeconds:30.0]; [imageRequest setDownloadCache:[ASIDownloadCache sharedCache]]; [imageRequest setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy]; [imageRequest setCachePolicy:ASIAskServerIfModifiedWhenStaleCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy]; [imageRequest setCompletionBlock:^(void){ UIImage *img = [UIImage imageWithData:[imageRequest responseData] ]; if (img){ return img; } }]; [imageRequest setFailedBlock:^(void){ […]

从SKScene演示UIViewController

我试图从SKScene提出一个UIViewController,但是,应用程序崩溃,这里是我的代码: 1-: UIViewController *vc = self.view.window.rootViewController; helpVC = [[HelpViewController alloc]initWithNibName:@"HelpViewController" bundle:nil]; [vc presentViewController: helpVC animated: YES completion:nil]; 2- helpVC = [[HelpViewController alloc]initWithNibName:@"HelpViewController" bundle:nil]; SKScene *sks = (SKScene*)helpVC; [self.view presentScene:sks]; 在这两种方式我的应用程序崩溃,感谢您的任何帮助 由于: 2014-02-08 16:38:29.119 BrickRacer[13883:70b] -[UIView presentScene:]: unrecognized selector sent to instance 0x10bb7ea50 2014-02-08 16:38:29.122 BrickRacer[13883:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView […]

将现有的CGColor分配给CGColor属性可以在iOS模拟器中使用,而不是iOS设备。 为什么?

我知道如何解决我要概述的问题,但是,为什么代码scheme在iOS模拟器中工作,而不是在我的iPad上,我有点困惑。 我有一个方法,检查各种属性,然后根据属性的状态设置CALayer的背景颜色。 以下代码与我的颜色分配方法类似: //This will be the CALayer BGColor… CGColor c = UIColor.blueColor.CGColor; //Blue is the default switch (myState) { case state_one: c = UIColor.greenColor.CGColor; //… more code … break; case state_two: c = UIColor.redColor.CGColor; //… more code … break; case state_three: //multiple cases are like the state_three case. //Other code, but I don't need […]

Swift – 使用downloadTaskWithURL下载video

我正在下载一个video感谢downloadTaskWithURL,我保存到我的画廊与此代码: func saveVideoBis(fileStringURL:String){ print("saveVideoBis"); let url = NSURL(string: fileStringURL); (NSURLSession.sharedSession().downloadTaskWithURL(url!) { (location:NSURL?, r:NSURLResponse?, e:NSError?) -> Void in let mgr = NSFileManager.defaultManager() let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]; print(documentsPath); let destination = NSURL(string: NSString(format: "%@/%@", documentsPath, url!.lastPathComponent!) as String); print(destination); try? mgr.moveItemAtPath(location!.path!, toPath: destination!.path!) PHPhotoLibrary.requestAuthorization({ (a:PHAuthorizationStatus) -> Void in PHPhotoLibrary.sharedPhotoLibrary().performChanges({ PHAssetChangeRequest.creationRequestForAssetFromVideoAtFileURL(destination!); }) { completed, error in […]

将数据存储到NSUserDefaults

在我的iPhone应用程序中,我有一个名为Contact的类,它由一个ABRecordRef组成,用作特定联系人的引用。 我需要将这些联系人的组存储在NSUserDefaults ,但是由于Contact是一个自定义类,所以事情并没有那么顺利。 任何想法在这种情况下做什么?

分割视图控制器必须是根视图控制器

每当我尝试以模态方式呈现UISplitViewController时,应用程序崩溃。 因此,它必须永远是根视图控制器。 任何人都可以确认吗?

自定义UITabBar背景图像不能在iOS 5及更高版本中使用

我有一个简单的一段代码,在tabBar上放置一个背景图像。 UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tabBG.png"]]; [self.tabBarController.tabBar insertSubview:imageView atIndex:0]; [imageView release]; 这在iOS 4中工作正常,但在iOS 5中testing时,它不起作用。 我正在尝试执行以下操作: UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tabBG.png"]]; NSString *reqSysVer = @"4.3"; NSString *iOSVersion = [[UIDevice currentDevice] systemVersion]; if ([iOSVersion compare:reqSysVer options:NSNumericSearch] !=NSOrderedDescending) { // code for iOS 4.3 or below [self.tabBarController.tabBar insertSubView:imageView atIndex:0]; } else { // code […]

UDID和UUID的区别

有人说UDID (Unique Device IDentifier) ,有人说UUID (Universally Unique IDentifier) 。 他们是否相同? 他们之间有什么区别?

是否有可能在运行时检测到您的iOS应用程序在iPad mini上运行?

在运行时检测不同的硬件对于分析是有用的(除此之外,更有疑问的目的)。 许多iOS应用程序创build者可能有兴趣知道有多less用户在iPad mini上体验他们的应用程序(而不是仅仅知道有多less用户在1024×768屏幕分辨率的iPad上体验他们的应用程序 – 这也将是有趣的)。 Cocoa touch/UIKit/ObjC/C是否有公开的API可用于检测您的iOS应用程序在运行时是否在iPad mini上运行? 理想情况下,这种方法应该区分iPad 2和iPad mini(具有相同的像素数量,但不同的像素密度)。 发布脚本:我意识到很多人会考虑在运行时检测iPad mini是一个坏主意。 不过,我认为这是一个有确定答案的有效问题。 我认为这对社区是有用的。

iOs5 iPad / iPhone中滚动的iframe内容不呈现

我正在开发需要显示来自其他来源(不同域)的网页的iPad的HTML5网页。 我将这些页面加载到iframe ,并使用iOs5新的滚动function滚动iframe ,如下面的代码所示。 <div id="myDiv" style="height: 1185px; width: 100%; overflow:scroll; -webkit-overflow-scrolling: touch;"> <iframe id="myIframe" src="http://http://css-tricks.com/forums/discussion/11946/scrolling-iframe-on-ipad/p1"></iframe> </div> 问题在于,滚动到屏幕外的iframe内容不可见(帧为空白)。 我如何克服这个问题,并提供可滚动的iframe解决scheme?