我正在尝试在现有的UIView类中实现imagePicker。看起来你只能在ViewController类中实现UIImagePickerController。
在实现imagePicker控制器时,我在编译之前收到“使用未解析的标识符'dismiss'”错误。
我已经探索了几种从UIView类中唤起imagePicker的方法,但没有成功。
我探讨过的一个选择是: 在UIViewController类型的UIView类中声明了一个变量(从中填充UIView类的父UIViewController类)。这导致每次我想添加图像时再次启动UIViewController类,这不是我正在寻找的
我这样做的原因是我已经从使用UIVIew类的UIViewController类实现了一个Scroll View。这些都是xib文件实现类。
有没有人尝试过这样的事情,或者有更好/可行的方法来实现我需要的东西?
请参阅下面的错误示例和一些代码示例:
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
huntlogEditVC.dismiss(animated: true, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
self.imageView.image = selectedImage
dismiss(animated: true, completion: nil)
}
答案 0 :(得分:1)
这对我来说非常好:
...
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
directory "./build/nodes"
node {
name "O=Notary,L=London,C=GB"
notary = [validating : true]
p2pPort 10002
rpcSettings {
address("localhost:10003")
adminAddress("localhost:10043")
}
cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
}
node {
name "O=PartyA,L=Tokyo,C=JP"
p2pPort 10005
rpcSettings {
address("localhost:10006")
adminAddress("localhost:10046")
}
webPort 10007
cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
name "O=PartyB,L=New York,C=US"
p2pPort 10008
rpcSettings {
address("localhost:10009")
adminAddress("localhost:10049")
}
webPort 10010
sshdPort 10024
cordapps = ["$corda_release_group:corda-finance:$corda_release_version"]
rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
}
...
答案 1 :(得分:0)
真正的答案可能是以稍微不同的方式对其进行重组,但对于一些简单的事情,直到你学到足够的知识为止。
<body>
<div class="htmlcontent" id="topcontent">
<div class="htmlpicture">
<img src="https://www.fing.edu.uy/inco/grupos/gsi/img/placeholder.png" alt="Placeholder" height="100%" width="100%">
</div>
<div class="htmltext">
<h2>WHO ARE WE?</h2>
<p>Lorem ipsum dolor sit amet consectetur adipiscing elit facilisis vel commodo, sem luctus tellus ac penatibus dictumst nostra dapibus tristique. Fames gravida scelerisque id lobortis magnis conubia mauris orci mi, morbi sociis phasellus sed ullamcorper litora sodales. Odio velit ante varius bibendum, faucibus blandit maecenas ligula torquent, ad netus sociosqu.</p>
</div>
</div>
<div class="htmlcontent">
<div class="htmlpicture" id="centerpicture">
<img src="https://www.fing.edu.uy/inco/grupos/gsi/img/placeholder.png" alt="Placeholder" height="100%" width="100%">
</div>
<div class="htmltext" id="centertext">
<h2>WHAT SETS US APART?</h2>
<p>Lorem ipsum dolor sit amet consectetur adipiscing elit facilisis vel commodo, sem luctus tellus ac penatibus dictumst nostra dapibus tristique. Fames gravida scelerisque id lobortis magnis conubia mauris orci mi, morbi sociis phasellus sed ullamcorper litora sodales. Odio velit ante varius bibendum, faucibus blandit maecenas ligula torquent, ad netus sociosqu.</p>
</div>
</div>
<div class="htmlcontent">
<div class="htmlpicture">
<img src="https://www.fing.edu.uy/inco/grupos/gsi/img/placeholder.png" alt="Placeholder" height="100%" width="100%">
</div>
<div class="htmltext">
<h2>COMMITED TO QUALITY</h2>
<p>Lorem ipsum dolor sit amet consectetur adipiscing elit facilisis vel commodo, sem luctus tellus ac penatibus dictumst nostra dapibus tristique. Fames gravida scelerisque id lobortis magnis conubia mauris orci mi, morbi sociis phasellus sed ullamcorper litora sodales. Odio velit ante varius bibendum, faucibus blandit maecenas ligula torquent, ad netus sociosqu.</p>
</div>
</div>
</body>
是UIImagePickerController
,它有一个名为UIViewController
的属性,它是提示选择器的viewController,所以......
presentingViewController
应该有用。
或者 - 你是如何首先提出选择器的?那个picker.presentingViewController.dismiss( ....
是你通常会被解雇的那个。