基于下面的图像(我使用不同颜色的圆和平面,所以他们可以看到,但最终颜色将是相同的),使用Swift和Spritekit,我试图创建一个圆形对象进入的效果厚物质(不一定是粘性的)并与厚物质分离.基本上,当圆形物体分离时,它会在形成圆形时从平坦表面拉开.我想使用图像动画帧,但由于对象是具有物理主体的SKSpriteNodes,因此这将使得对象与动画的碰撞非常困难.另一种方法是使用CAAnimation,但我不知道如何将这与SKSpriteNodes与物理实体结合起来.如何使用上述任何方法或不同方法创建此分离效果?
UPDATE
下图显示了当圆形物体进入厚物质直至其浸没时,厚物质表面的变化.
我已经实现了UIPageViewController的数据源方法,但仍然没有在我的iOS应用程序底部获得点.任何人都有任何解决方案,使我的应用程序上出现点?
我从数据库中取出一个电话号码,当用户开始在文本字段中编辑以更改该电话号码时,我想使用我当前在数据库中的号码作为占位符.由于此信息随每个用户而变化,我如何在swift中以编程方式设置它?
我正在使用Xcode 7.3并在我的viewcontroller和storyboard项目周围遇到蓝线问题,如附图所示.我重新安装了我的xcode两次,但这个问题没有解决.如有任何帮助,我们将不胜感激.
使用此函数获取多页pdf版本的tableView,只需将tableView名称传递给此函数: -
func pdfDataWithTableView(tableView: UITableView) {
let priorBounds = tableView.bounds
let fittedSize = tableView.sizeThatFits(CGSizeMake(priorBounds.size.width, tableView.contentSize.height))
tableView.bounds = CGRectMake(0, 0, fittedSize.width, fittedSize.height)
let pdfPageBounds = CGRectMake(0, 0, tableView.frame.width, self.view.frame.height)
let pdfData = NSMutableData()
UIGraphicsBeginPDFContextToData(pdfData, pdfPageBounds,nil)
var pageOriginY: CGFloat = 0
while pageOriginY < fittedSize.height {
UIGraphicsBeginPDFPageWithInfo(pdfPageBounds, nil)
CGContextSaveGState(UIGraphicsGetCurrentContext())
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0, -pageOriginY)
tableView.layer.renderInContext(UIGraphicsGetCurrentContext()!)
CGContextRestoreGState(UIGraphicsGetCurrentContext())
pageOriginY += pdfPageBounds.size.height
}
UIGraphicsEndPDFContext()
tableView.bounds = priorBounds
var docURL = (NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)).last! as NSURL
docURL = docURL.URLByAppendingPathComponent( "myDocument.pdf")
pdfData.writeToURL(docURL, atomically: true)
}
Run Code Online (Sandbox Code Playgroud) 我正在开发一个 iPhone 应用程序,如果发生按钮事件,我必须在其中显示一些自定义选择器。但我不想为我的自定义选择器视图的框架硬编码值。我搜索并找到了keyboardWillShow通知 userInfo 方法,但就我而言,我没有显示键盘,因此无法从中获取框架。任何人都可以帮助我获得可用于我的自定义选择器的键盘框架吗?
我正在开发一个ios应用程序,一切都很顺利然后我突然得到了这个错误
error: /Users/himanshututeja/Library/Developer/Xcode/DerivedData/xxxxx-ebvzljjfvuvqcubfgvneealjrdrg/Build/Products/Debug-iphoneos/Alamofire.framework: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我删除了xcode的派生数据文件夹,仍然没有帮助.有谁知道我面对这个问题的原因?
我有以下自定义注释类:
import UIKit
import MapKit
class LocationMapAnnotation: NSObject, MKAnnotation {
var title: String?
var coordinate: CLLocationCoordinate2D
var location: Location
init(title: String, coordinate: CLLocationCoordinate2D, location: Location) {
self.title = title
self.coordinate = coordinate
self.location = location
}
}
Run Code Online (Sandbox Code Playgroud)
我正在将注释加载到这样的地图视图中:
for i in 0..<allLocations.count{
//Add an annotation
let l: Location = self.allLocations[i] as! Location
let coordinates = CLLocationCoordinate2DMake(l.latitude as Double, l.longitude as Double)
let annotation = LocationAnnotation(title: l.name, coordinate: coordinates, location: l)
mapView.addAnnotation(annotation)
}
Run Code Online (Sandbox Code Playgroud)
我想Location从选定的注释中获取对象.目前我有这个方法,当我点击注释时调用,但我不确定如何从注释中检索特定对象.
func mapView(mapView: MKMapView, didSelectAnnotationView view: …Run Code Online (Sandbox Code Playgroud) 我收到此错误作为JSON result.error。虽然我的JSON是有效的JSON,但请在线检查JSON vaildator。
这是我的JSON请求代码。
Alamofire.request(.POST, url, parameters: parameters, encoding:.JSON)
.responseJSON { (request, response, result) in
hud.hide(true)
// Set flag to disale poor internet connection alert
weakInternet = false
print(result.error)
if (result.value != nil) {
print("API Response: \(result.value!)")
// Pass the response JSON to the completion block
completion(json: result.value!)
} else {
// Response JSON is NULL
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用特定的请求参数访问相同的服务时,我会收到此响应。
{"error":"success","post_data":{"first_name":"hd","last_name":"df","email":"hiiaaaaaaa@dnsa.coma","password":"himanshu","confirm_password":"himanshu","companies":["Big Rattle Technologies_Fg_yes"],"institutes":[""]},"msg":"success","data":{"_id":"5742ae1564b35e37369f0838","first_name":"hd","last_name":"df","email":"hiiaaaaaaa@dnsa.coma","profile_pic":"","loc":[0,0],"locs":{"type":"Point","coordinates":[0,0]},"institutes":[],"companies":[{"comapny_id":"555b2d0a678e79ed510041ce","group_id":"556c2434678e79a1820041dd","name":"Big Rattle Technologies","designation":"Fg","is_current":"yes"}],"device_token":"","user_group":"site_user","is_verified":0,"is_disclose":1,"is_discover":1,"wallNotification":1,"messageNotification":1,"matchNotification":1,"verificationSent":0,"status":1,"mobile":"","linkedin_id":"","facebook_id":"","os":"","qblox_id":12957726,"updated_at":"2016-05-23 07:15:33","created_at":"2016-05-23 07:15:33","current_company":"Big Rattle Technologies"}}
Run Code Online (Sandbox Code Playgroud)
有人知道我的问题是什么吗?
我正在尝试通过QUICKBLOX并在编译我的加入小组代码后加入一个小组。向我显示此错误。
(Error Domain=com.quickblox.chat Code=-1004 "(null)" UserInfo={NSLocalizedRecoverySuggestion=You have to be connected to Chat in order to use Chat API.})
Run Code Online (Sandbox Code Playgroud)
我的代码是:-
let groupChatDialog: QBChatDialog = QBChatDialog(dialogID: "57442b84a28f9a759100000e", type: QBChatDialogType.Group)
self.groupChatDialog.joinWithCompletionBlock { (error: NSError?) -> Void in
print(error)
Run Code Online (Sandbox Code Playgroud)
任何人都知道这是什么问题。
swift ×9
ios ×8
alamofire ×2
annotations ×1
json ×1
keyboard ×1
mkmapview ×1
pdf ×1
placeholder ×1
quickblox ×1
sprite-kit ×1
storyboard ×1
uitableview ×1
uitextfield ×1
xcode ×1