我目前的代码:
if let var timeResult = (jsonResult["dt"] as? Double) {
timeResult = NSDate().timeIntervalSince1970
println(timeResult)
println(NSDate())
}
Run Code Online (Sandbox Code Playgroud)
结果:
println(timeResult) = 1415639000.67457
println(NSDate())= 2014-11-10 17:03:20 +0000只是为了测试看看NSDate提供什么.
我希望第一个看起来像最后一个.dt = 1415637900的值.
另外,我如何调整时区?在iOS上运行.
在我的tableViewController中,我有以下内容.我试图删除一个项目工作.
var myData: Array<AnyObject> = []
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellID: NSString = "Cell"
var Cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellID) as UITableViewCell
var data: NSManagedObject = myData[indexPath.row] as NSManagedObject
Cell.textLabel?.text = data.valueForKeyPath("Name") as? String
return Cell
}
Run Code Online (Sandbox Code Playgroud)
然后尝试删除我有.
override func tableView(tableView: (UITableView!), commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
let cellID: NSString = "Cell"
var Cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellID) as UITableViewCell
var data: NSManagedObject = myData[indexPath.row] as NSManagedObject
data.delete(0) …Run Code Online (Sandbox Code Playgroud) 我无法调整我创建的文本编辑器的外观。文本将有边距。\n我尝试自己做,但我搞砸了,我不能\t我希望它像图片一样。
\n\n VStack {\n TextEditor(text: $inputText)\n .background(Color.black)\n .frame(height:geometry.size.height / 3, alignment: .center)\n .cornerRadius(25)\n .border(Color.yellow, width: 5)\n .lineSpacing(10)\n .autocapitalization(.words)\n .disableAutocorrection(true)\n .padding() \n }\n\n Spacer().frame(height: geometry.size.height / 15)\n\n VStack {\n Button(action: {}, label: {\n Text("G\xc3\xb6nder")\n .frame(width: geometry.size.width / 3, height: 50)\n .padding(10)\n .font(Font.system(size: 30, weight: .medium, design: .serif))\n .foregroundColor(.white)\n .background(RoundedRectangle(cornerRadius: 30))\n .foregroundColor(.init(red: 45 / 255, green: 0 / 255, blue: 112 / 255))\n\n })\n }\nRun Code Online (Sandbox Code Playgroud)\n 我该如何将其转换为快速?我最好的猜测是所有的int都变成了var.删除所有@那个领导".如果有的话可以指向一个好的来源,以了解事情如何转换,这将是伟大的.
- (NSString*)coordinateString {
int latSeconds = (int)(self.latitude * 3600);
int latDegrees = latSeconds / 3600;
latSeconds = ABS(latSeconds % 3600);
int latMinutes = latSeconds / 60;
latSeconds %= 60;
int longSeconds = (int)(self.longitude * 3600);
int longDegrees = longSeconds / 3600;
longSeconds = ABS(longSeconds % 3600);
int longMinutes = longSeconds / 60;
longSeconds %= 60;
NSString* result = [NSString stringWithFormat:@"%d°%d'%d\"%@ %d°%d'%d\"%@",
ABS(latDegrees),
latMinutes,
latSeconds,
latDegrees >= 0 ? @"N" : @"S",
ABS(longDegrees),
longMinutes,
longSeconds,
longDegrees >= 0 ? @"E" …Run Code Online (Sandbox Code Playgroud) let latitude:CLLocationDegrees = 76.0100
let longitude:CLLocationDegrees =25.3620
let location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)
let latDelta:CLLocationDegrees = 1
let lonDelta:CLLocationDegrees = 1
let span:MKCoordinateSpan = MKCoordinateSpanMake(latDelta, lonDelta)
let region:MKCoordinateRegion = MKCoordinateRegionMake(location, span)
mapView.setRegion(region, animated: true)
let annotation:MKPointAnnotation = MKPointAnnotation()
annotation.coordinate = location
annotation.title = "Office ."
annotation.subtitle = "My Office"
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
print("Locations = \(locations)")
let userLocation: CLLocation = locations[0] as CLLocation
//var latitude:CLLocationDegrees = userLocation.coordinate
//var longitude:CLLocationDegrees = -121.934048
//var location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)
let latDelta:CLLocationDegrees …Run Code Online (Sandbox Code Playgroud) 致命错误的问题:在展开Optional值时意外发现nil.
let lastupdate = defaults.stringForKey("localdate")
self.lastUpdate.text = "Updated at " + last update! //issues when I use this line
self.lastUpdate.text = lastupdate // If use this line I have no issues.
Run Code Online (Sandbox Code Playgroud)
如果我预先填充数据,则有效.但我想允许零值.