gpt4 book ai didi

ios - CNContactViewController 按钮 Action

转载 作者:可可西里 更新时间:2023-11-01 02:02:01 25 4
gpt4 key购买 nike

我正在使用 CNContactViewController。但是,我想添加一个新按钮。我该怎么做

如果你不能添加一个新的按钮,那么我如何获得调用按钮的 Action ?

enter image description here

最佳答案

你能试试这样吗,但我已经用于新联系人,你可以用你的代码自定义。

func CreateNewContact() {

let contact = CNMutableContact()


let unkvc = CNContactViewController(forNewContact: contact)
unkvc.delegate = self
unkvc.allowsEditing = true
unkvc.allowsActions = true
unkvc.title = "Create New Contact"
self.navigationController?.isNavigationBarHidden = false

self.navigationController?.navigationBar.backgroundColor = UIColor(red: 234.0/255.0, green: 34.0/255.0, blue: 39.0/255.0, alpha: 1.0)
self.navigationController?.navigationBar.tintColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0)

Application.Delegate.setStatusBarBackgroundColor(color: UIColor(red: 198/255.0, green: 6/255.0, blue: 39.0/255.0, alpha: 1.0))


self.navigationController?.navigationItem.hidesBackButton = true

let rightButton: UIBarButtonItem = UIBarButtonItem(title: "Done", style: UIBarButtonItemStyle.done, target: self, action: #selector(ShowInfotoshare.doneButtonClicked(_:)))

self.navigationController?.navigationItem.rightBarButtonItem = rightButton


self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white]

self.navigationController?.pushViewController(unkvc, animated: false)



}

func doneButtonClicked(_ button:UIBarButtonItem!){
print("Done clicked")
}

如果您有任何疑问,请告诉我您的代码,以便我帮助您。

关于ios - CNContactViewController 按钮 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45594234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com