class ViewController: UIViewController, UIImagePickerControllerDelegate,
UINavigationControllerDelegate, UITextFieldDelegate {
@IBOutlet weak var topText: UITextField!
@IBOutlet weak var bottomText: UITextField!
@IBOutlet weak var imagePickerView: UIImageView!
//let stokeColor = NSStrokeColorAttributeName("stoke")
let memeTextAttributes:[String:Any] = [
NSAttributedStringKey.strokeColor.rawValue: UIColor.blue/* TODO: fill in appropriate UIColor */,
NSAttributedStringKey.foregroundColor.rawValue: UIColor.cyan/* TODO: fill in appropriate UIColor */,
NSAttributedStringKey.font.rawValue: UIFont(name: "HelveticaNeue-CondensedBlack", size: 40)!,
NSAttributedStringKey.strokeWidth.rawValue: 0.5/* TODO: fill in appropriate Float */]
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
topText.textAlignment = .center
topText.text = "TOP"
topText.delegate = self
topText.borderStyle = .none
topText.defaultTextAttributes = memeTextAttributes
bottomText.textAlignment = .center
bottomText.text = "BOTTOM"
bottomText.delegate = self
topText.borderStyle = .none
bottomText.defaultTextAttributes = memeTextAttributes
}
答案 0 :(得分:0)
这似乎是因为您在topText
上两次设置了边框样式...
topText.textAlignment = .center
topText.text = "TOP"
topText.delegate = self
// you set top text border style to none here...
topText.borderStyle = .none
topText.defaultTextAttributes = memeTextAttributes
bottomText.textAlignment = .center
bottomText.text = "BOTTOM"
bottomText.delegate = self
// then set it again here... pretty sure you want this to be bottomText.borderStyle = .none
topText.borderStyle = .none
bottomText.defaultTextAttributes = memeTextAttributes
答案 1 :(得分:0)
您要两次设置顶部文本边框样式。请检查您的底部文字代码。您没有在任何地方设置底部文本的边框。