Tag: ios

iOS的SceneKit霓虹灯发光

一直在看Scenekit的照明,而我现在可以应用一个照明节点来点亮一些东西,我正在寻找一种方法来从一个对象内部点亮。 举一个例子,想像一下霓虹灯,或者一个灯泡,将光线投射到其他物体上。 任何想法如何实现这一目标? 非常感谢。

启动图像(启animation面)和应用程序主页之间的白色闪烁

我有一个非常简单的HTML5 iPhone Web应用程序,几乎完美的工作; 只有一个问题:在启动图像和应用程序主屏幕之间,出现一个完全白色的屏幕(即闪烁)约一秒钟。 我使用“添加到主屏幕”button将应用程序从networking下载到我的手机。 JavaScript文件( functions.js )和样式表都是非常小的文件。 有没有人有这个问题? 有什么办法解决/修复它? 的index.html <!doctype html> <html manifest="demo.manifest"> <head> <meta charset="UTF-8"> <title>HTML5 Application</title> <link rel="stylesheet" type="text/css" href="style.css" /> <link rel="apple-touch-icon-precomposed" href="Icon@2x.png" /> <link rel="apple-touch-startup-image" href="Default@2x.png" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="viewport" content="user-scalable=no, width=device-width" /> </head> <body> <div id="wrapper">…</div> </body> <script type="text/javascript" src="function.js"></script> </html> demo.manifest CACHE MANIFEST index.html […]

当用户获得推送通知时如何播放自定义声音文件?

我在应用程序包中有一个声音文件,当用户将得到推送通知时,我想播放该声音文件。 如果是的话,是否有可能在iOS上,那么请build议的方式来实现这一点。 谢谢,

有没有什么办法编程发送我的iPhone应用程序的背景

我有一个iPhone应用程序,我需要自动发送到后台。 该应用程序是在VOIP键的后台模式下定义的,因此在后台应该继续运行。 我特别需要应用程序继续运行,所以调用exit(0)是不好的。 该应用程序不会通过应用程序商店分发,所以使用私人API是好的。 我已阅读有关UIApplication终止和UIApplication terminateWithSuccess但他们似乎不再可用

将UITapGestureRecognizer添加到UITextView而不阻止textView触摸

我如何添加一个UITapGestureRecognizer到一个UITextView,但仍然有触及通过UITextView 正常 ? 目前只要我添加一个自定义的手势到我的textView它会阻止UITextView的默认动作,如定位光标。 var tapTerm:UITapGestureRecognizer = UITapGestureRecognizer() override func viewDidLoad() { tapTerm = UITapGestureRecognizer(target: self, action: "tapTextView:") textView.addGestureRecognizer(tapTerm) } func tapTextView(sender:UITapGestureRecognizer) { println("tapped term – but blocking the tap for textView :-/") … } 我怎样才能处理水龙头,但像光标定位保持任何textView行为?

将stringMM / DD / YYYY转换为NSDate

在我的应用程序中,我正在使用Facebook Graph API,当我提取用户的详细信息时,我将用户的生日作为格式为MM / DD / YYYY的string。 我的问题是,如何将string“MM / DD / YYYY”转换为NSDate ? 我试着做 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"MM/DD/YYYY"]; NSDate *date = [dateFormatter dateFromString:@"08/08/2012"]; [dateFormatter release]; 但是我收到了错误的date

如何使用writeToFile将图像保存在文档目录中?

// directoryPath is a URL from another VC @IBAction func saveButtonTapped(sender: AnyObject) { let directoryPath = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL let urlString : NSURL = directoryPath.URLByAppendingPathComponent("Image1.png") print("Image path : \(urlString)") if !NSFileManager.defaultManager().fileExistsAtPath(directoryPath.absoluteString) { UIImageJPEGRepresentation(self.image, 1.0)!.writeToFile(urlString.absoluteString, atomically: true) displayImageAdded.text = "Image Added Successfully" } else { displayImageAdded.text = "Image Not Added" print("image \(image))") } } […]

使用Mobile Safari“表单助手”更改未选中元素的事件

我有dynamicselect下拉菜单。 例如,如果select特定的月份,则第二个select元素将填充该月的天数。 这可以按预期工作,但是当用户使用iPhone并使用Mobile Safari“表单助手”内置的“下一步”button时, change事件(使用jQuery)不会触发,第二个select不会更新。 $('.month').change(function() { // update "days" select element }); 仅供参考我也使用jQuery手机

谷歌地图不会显示在Phonegap的iOS应用程序

我有一个PhoneGap iOS应用程序,并有这个HTML,不会显示在应用程序中的地图。 我在Safari或FF中完美地看到地图,但在应用程序中却看不到。 我怎样才能使这个工作? <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script src="http://code.jquery.com/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var initialLocation = new google.maps.LatLng(37.654,-77.980); var myOptions = { zoom: 12, center: initialLocation, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); }); </script> </head> <body> <div data-role="content"> <!–images go here –> <div class="img_shadow" style="padding:4px;"> <div id="map_canvas" style="height:130px;"></div> </div> </div> </div><!– /page –> […]

自定义UITableViewCellbutton操作?

我一直在四处寻找解决scheme,但似乎无法find一个适合我的工作。 我有一个自定义的单元格,里面有一个button。 我的问题是如何将indexPath传递给动作方法? 现在我正在做 [cell.showRewards addTarget:self action:@selector(myAction:) forControlEvents:UIControlEventTouchUpInside]; 在我的cellForRowAtIndexPath方法和我的方法是: -(IBAction)myAction:(id)sender{ NSIndexPath *indexPath = [self.tableView indexPathForCell:(MyCustomCell *)[sender superview]]; NSLog(@"Selected row is: %d",indexPath.row); } 有小费吗? 谢谢。