Skip to content

Instantly share code, notes, and snippets.

@schifano
Created August 27, 2015 22:09
Show Gist options
  • Save schifano/13dad6b80bd140d1292f to your computer and use it in GitHub Desktop.
Save schifano/13dad6b80bd140d1292f to your computer and use it in GitHub Desktop.
Experimental code from MemeMe app and former drawTextInRect method.
topTextField.frame = CGRect(x: rect.origin.x, y: rect.origin.y + 500, width: 500, height: 100)
topTextField.backgroundColor = UIColor.blueColor()
self.imageView.addSubview(topTextField)
// I just wasn't changing it enough, 10 pts is really small, apparently
var y: CGFloat = (rect.origin.y - 50.0)
// TEST - DOES THIS EVEN PUT A THING ANYWHERE (the answer was no, bc of autolayout and constraints)
var testTopTextField: UITextField = UITextField(frame: CGRect(x: rect.origin.x + 10, y: y, width: 300.0, height: 50.0))
testTopTextField.text = "KITTENS"
testTopTextField.backgroundColor = UIColor.greenColor()
self.imageView.addSubview(testTopTextField)
var testBottomTextField: UITextField = UITextField(frame: CGRect(x: rect.origin.x, y: rect.origin.y + (rect.size.height / 2), width: 300.0, height: 50.0))
testBottomTextField.text = "R SO CEWT"
testBottomTextField.backgroundColor = UIColor.purpleColor()
self.imageView.addSubview(testBottomTextField)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment