点击按钮时访问照片库时遇到麻烦.像往常一样,我在问它是否可以访问.以下是我的代码
@IBAction func photoLibraryButtonTapped(sender: UIButton) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
imagePicker.allowsEditing = true
self.presentViewController(imagePicker, animated: true, completion: nil)
}
}
Run Code Online (Sandbox Code Playgroud)
这是Xcode所说的:
2016-08-08 23:05:11.209 Auyrma[1799:20237892] -[UIViewController photoLibraryButtonTapped:]: unrecognized selector sent to instance 0x7fd3e9d39ed0
2016-08-08 23:05:11.214 Auyrma[1799:20237892] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController photoLibraryButtonTapped:]: unrecognized selector sent to instance 0x7fd3e9d39ed0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000113fdcd85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000113a50deb objc_exception_throw + 48
2 …Run Code Online (Sandbox Code Playgroud) 我现在使用 Swift 2.3。我使用以下代码为按钮添加了边框:
self.history.layer.borderWidth = 1
self.history.layer.borderColor = UIColor.mainColor().CGColor
Run Code Online (Sandbox Code Playgroud)
现在,我需要删除左右边框,只剩下顶部和底部边框。我该如何管理?
补充:感谢@Teja,我看到了另一个问题CALayer:仅在一侧添加边框 但是,问题是我需要底部和顶部。但是,在添加-1、-1 CALayer 之后,只添加了底部的一个。