我正试图在我的快速代码中实现3D Touch Peek和Pop。当用户在窥视视图上按下更深处时,将显示一系列预览操作(共享,更新,删除)。
我需要的是当用户选择更新操作将移动到UpdateView控制器,但它继续崩溃!
这是我的代码:
HomePeakViewController.swift
let item3 = UIPreviewAction(title: "Update", style: .Default) { (action:UIPreviewAction, vc:UIViewController) -> Void in
print("Update")
let nb:BookAppointmentViewController = BookAppointmentViewController(nibName: "BookAppointmentViewController", bundle: nil)
let root = UIApplication.sharedApplication().keyWindow?.rootViewController
root?.presentViewController(nb, animated: true, completion: nil)
HomeViewController.swift中的POP方法
func previewingContext(previewingContext: UIViewControllerPreviewing, commitViewController viewControllerToCommit: UIViewController) {
let Homepeak = HomePeakViewController()
showViewController(Homepeak, sender: self)
}
我也尝试使用此代码移动到更新屏幕,但它给了我(致命错误:在解开可选值时意外地发现了nil。)
var top = UIApplication.sharedApplication().keyWindow?.rootViewController
let test = AppointmentDetailsViewController()
top!.presentViewController(test, animated: true, completion: {})
非常感谢您的努力。
答案 0 :(得分:0)
也许你需要与代表团打交道:
例如:
<h1 class="ui header">Add product</h1>
<form class="ui form">
<div class="four wide field">
<label>Category</label>
<category-selector (selection)="setCategory($event)" defaultText="Please Choose a Category"></category-selector>
</div>
<div class="four wide field" *ngIf="selectedCategory">
<label>Product</label>
<product-selector (selection)="setProduct($event)" [category]="selectedCategory" defaultText="Select a Product"></product-selector>
</div>
</form>