Textfield movable programmatically swift 4












1















I need your help.. I need to be able to move a UITextField with the UITapGestureRecognizer. The textField is inserted in a view, how can I touch it and move it in the View?



And how can I connect my textfield to the color and font buttons, so when I click on one of them I change the color or font to my TextField?



import UIKit
import Foundation
import Constrainable

class FontCell: UICollectionViewCell {
static let reuseIdentifier = "FontCell_RID"

override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}

var cellID: String?

static let nameLabel = ["Little", "Baby", "Kiss", "love", "Sweet", "Happy", "Cuddle", "Pretty", "Smile", "hug", "Mommy", "Daddy"]

var array = UILabel().then{
$0.contentMode = UIView.ContentMode.scaleAspectFit
$0.layer.cornerRadius = (((UIScreen.main.bounds.size.width/8)*0.8)/2)
}

func setupViews(){
self.addSubview(self.array)
self.array.activate([
array.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 0.8),
array.heightAnchor.constraint(equalTo: self.array.widthAnchor),
array.centerXAnchor.constraint(equalTo: self.centerXAnchor),
array.centerYAnchor.constraint(equalTo: self.centerYAnchor),
])
}

func setContents(container: UILabel) {
for sv in self.contentView.subviews {
sv.removeFromSuperview()
}
self.contentView.addSubview(container)
container.activate(constraint(edgesTo: self.contentView))
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

import UIKit
import Constrainable

protocol FontDelegate: class {
func sincronizeScroll(indexPath: IndexPath)
}

class CollectionFont: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
weak var delegate: FontDelegate?
var collectionView: UICollectionView?
let cellSpacing:CGFloat = 1
let indexPath: IndexPath
var datasource: [UIFont] =
var imageArray: Array<UIImageView> =
var onceOnly = false

init(datasource: [UIFont], index: IndexPath = [0,0]) {
self.indexPath = index
self.datasource = Theme.CustomFontsFamily.customFonts
super.init(nibName: nil, bundle: nil)
}

override func viewDidLoad() {
super.viewDidLoad()
collectionView?.delegate = self
collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: UICollectionViewLayout())
collectionView!.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(collectionView!)
collectionView!.activate(constraint(edgesTo: self.view))
collectionView!.backgroundColor = Theme.Colors.sky
let collectionViewFlowLayout = UICollectionViewFlowLayout()
collectionView!.setCollectionViewLayout(collectionViewFlowLayout, animated: true)
collectionViewFlowLayout.scrollDirection = .horizontal
collectionViewFlowLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
collectionViewFlowLayout.minimumLineSpacing = 0
collectionViewFlowLayout.minimumInteritemSpacing = 0
collectionView!.register(FontCell.self, forCellWithReuseIdentifier: FontCell.reuseIdentifier)
collectionView!.delegate = self
collectionView!.dataSource = self
collectionView!.isPagingEnabled = true
collectionView!.bounces = false
self.collectionView?.reloadData()
}

class FontRound {
let font: UILabel

init(font: UILabel) {
self.font = font
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.datasource.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FontCell.reuseIdentifier, for: indexPath) as! FontCell
cell.array.text = FontCell.nameLabel[indexPath.row]
cell.array.font = self.datasource[indexPath.row]
cell.array.textColor = Theme.Colors.labelText
return cell
}

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = UIScreen.main.bounds.size.width/4
let height = UIScreen.main.bounds.size.width/4
return CGSize(width: width, height: height)
}

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
debugPrint("ciaooooo")

}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
var visibleRect = CGRect()
visibleRect.origin = collectionView!.contentOffset
visibleRect.size = collectionView!.bounds.size
let visiblePoint = CGPoint(x: visibleRect.midX, y: visibleRect.midY)
guard let indexPath = collectionView!.indexPathForItem(at: visiblePoint) else { return }
print(indexPath[1])
self.delegate?.sincronizeScroll(indexPath: indexPath)
}

internal func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if !onceOnly {
collectionView.scrollToItem(at: self.indexPath, at: UICollectionView.ScrollPosition.right, animated: false)
onceOnly = true
}
}
}

final class CollectionFontView: UICollectionView {

init(_ collectionViewLayout: UICollectionViewLayout) {
super.init(frame: .zero, collectionViewLayout: collectionViewLayout)
self.showsHorizontalScrollIndicator = false
register(FontCell.self, forCellWithReuseIdentifier: FontCell.reuseIdentifier)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}











share|improve this question




















  • 1





    If you want to move your UITextField, you can try UIPanGestureRecognizer instead of UITapGestureRecognizer

    – Quoc Nguyen
    Nov 16 '18 at 0:20











  • @QuocNguyen ok, thank you, I try now. instead can you give me some indication on how to hook colors and fonts to the Text? so that it changes color when I press a button?

    – user10660003
    Nov 16 '18 at 8:54
















1















I need your help.. I need to be able to move a UITextField with the UITapGestureRecognizer. The textField is inserted in a view, how can I touch it and move it in the View?



And how can I connect my textfield to the color and font buttons, so when I click on one of them I change the color or font to my TextField?



import UIKit
import Foundation
import Constrainable

class FontCell: UICollectionViewCell {
static let reuseIdentifier = "FontCell_RID"

override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}

var cellID: String?

static let nameLabel = ["Little", "Baby", "Kiss", "love", "Sweet", "Happy", "Cuddle", "Pretty", "Smile", "hug", "Mommy", "Daddy"]

var array = UILabel().then{
$0.contentMode = UIView.ContentMode.scaleAspectFit
$0.layer.cornerRadius = (((UIScreen.main.bounds.size.width/8)*0.8)/2)
}

func setupViews(){
self.addSubview(self.array)
self.array.activate([
array.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 0.8),
array.heightAnchor.constraint(equalTo: self.array.widthAnchor),
array.centerXAnchor.constraint(equalTo: self.centerXAnchor),
array.centerYAnchor.constraint(equalTo: self.centerYAnchor),
])
}

func setContents(container: UILabel) {
for sv in self.contentView.subviews {
sv.removeFromSuperview()
}
self.contentView.addSubview(container)
container.activate(constraint(edgesTo: self.contentView))
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

import UIKit
import Constrainable

protocol FontDelegate: class {
func sincronizeScroll(indexPath: IndexPath)
}

class CollectionFont: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
weak var delegate: FontDelegate?
var collectionView: UICollectionView?
let cellSpacing:CGFloat = 1
let indexPath: IndexPath
var datasource: [UIFont] =
var imageArray: Array<UIImageView> =
var onceOnly = false

init(datasource: [UIFont], index: IndexPath = [0,0]) {
self.indexPath = index
self.datasource = Theme.CustomFontsFamily.customFonts
super.init(nibName: nil, bundle: nil)
}

override func viewDidLoad() {
super.viewDidLoad()
collectionView?.delegate = self
collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: UICollectionViewLayout())
collectionView!.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(collectionView!)
collectionView!.activate(constraint(edgesTo: self.view))
collectionView!.backgroundColor = Theme.Colors.sky
let collectionViewFlowLayout = UICollectionViewFlowLayout()
collectionView!.setCollectionViewLayout(collectionViewFlowLayout, animated: true)
collectionViewFlowLayout.scrollDirection = .horizontal
collectionViewFlowLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
collectionViewFlowLayout.minimumLineSpacing = 0
collectionViewFlowLayout.minimumInteritemSpacing = 0
collectionView!.register(FontCell.self, forCellWithReuseIdentifier: FontCell.reuseIdentifier)
collectionView!.delegate = self
collectionView!.dataSource = self
collectionView!.isPagingEnabled = true
collectionView!.bounces = false
self.collectionView?.reloadData()
}

class FontRound {
let font: UILabel

init(font: UILabel) {
self.font = font
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.datasource.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FontCell.reuseIdentifier, for: indexPath) as! FontCell
cell.array.text = FontCell.nameLabel[indexPath.row]
cell.array.font = self.datasource[indexPath.row]
cell.array.textColor = Theme.Colors.labelText
return cell
}

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = UIScreen.main.bounds.size.width/4
let height = UIScreen.main.bounds.size.width/4
return CGSize(width: width, height: height)
}

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
debugPrint("ciaooooo")

}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
var visibleRect = CGRect()
visibleRect.origin = collectionView!.contentOffset
visibleRect.size = collectionView!.bounds.size
let visiblePoint = CGPoint(x: visibleRect.midX, y: visibleRect.midY)
guard let indexPath = collectionView!.indexPathForItem(at: visiblePoint) else { return }
print(indexPath[1])
self.delegate?.sincronizeScroll(indexPath: indexPath)
}

internal func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if !onceOnly {
collectionView.scrollToItem(at: self.indexPath, at: UICollectionView.ScrollPosition.right, animated: false)
onceOnly = true
}
}
}

final class CollectionFontView: UICollectionView {

init(_ collectionViewLayout: UICollectionViewLayout) {
super.init(frame: .zero, collectionViewLayout: collectionViewLayout)
self.showsHorizontalScrollIndicator = false
register(FontCell.self, forCellWithReuseIdentifier: FontCell.reuseIdentifier)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}











share|improve this question




















  • 1





    If you want to move your UITextField, you can try UIPanGestureRecognizer instead of UITapGestureRecognizer

    – Quoc Nguyen
    Nov 16 '18 at 0:20











  • @QuocNguyen ok, thank you, I try now. instead can you give me some indication on how to hook colors and fonts to the Text? so that it changes color when I press a button?

    – user10660003
    Nov 16 '18 at 8:54














1












1








1








I need your help.. I need to be able to move a UITextField with the UITapGestureRecognizer. The textField is inserted in a view, how can I touch it and move it in the View?



And how can I connect my textfield to the color and font buttons, so when I click on one of them I change the color or font to my TextField?



import UIKit
import Foundation
import Constrainable

class FontCell: UICollectionViewCell {
static let reuseIdentifier = "FontCell_RID"

override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}

var cellID: String?

static let nameLabel = ["Little", "Baby", "Kiss", "love", "Sweet", "Happy", "Cuddle", "Pretty", "Smile", "hug", "Mommy", "Daddy"]

var array = UILabel().then{
$0.contentMode = UIView.ContentMode.scaleAspectFit
$0.layer.cornerRadius = (((UIScreen.main.bounds.size.width/8)*0.8)/2)
}

func setupViews(){
self.addSubview(self.array)
self.array.activate([
array.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 0.8),
array.heightAnchor.constraint(equalTo: self.array.widthAnchor),
array.centerXAnchor.constraint(equalTo: self.centerXAnchor),
array.centerYAnchor.constraint(equalTo: self.centerYAnchor),
])
}

func setContents(container: UILabel) {
for sv in self.contentView.subviews {
sv.removeFromSuperview()
}
self.contentView.addSubview(container)
container.activate(constraint(edgesTo: self.contentView))
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

import UIKit
import Constrainable

protocol FontDelegate: class {
func sincronizeScroll(indexPath: IndexPath)
}

class CollectionFont: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
weak var delegate: FontDelegate?
var collectionView: UICollectionView?
let cellSpacing:CGFloat = 1
let indexPath: IndexPath
var datasource: [UIFont] =
var imageArray: Array<UIImageView> =
var onceOnly = false

init(datasource: [UIFont], index: IndexPath = [0,0]) {
self.indexPath = index
self.datasource = Theme.CustomFontsFamily.customFonts
super.init(nibName: nil, bundle: nil)
}

override func viewDidLoad() {
super.viewDidLoad()
collectionView?.delegate = self
collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: UICollectionViewLayout())
collectionView!.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(collectionView!)
collectionView!.activate(constraint(edgesTo: self.view))
collectionView!.backgroundColor = Theme.Colors.sky
let collectionViewFlowLayout = UICollectionViewFlowLayout()
collectionView!.setCollectionViewLayout(collectionViewFlowLayout, animated: true)
collectionViewFlowLayout.scrollDirection = .horizontal
collectionViewFlowLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
collectionViewFlowLayout.minimumLineSpacing = 0
collectionViewFlowLayout.minimumInteritemSpacing = 0
collectionView!.register(FontCell.self, forCellWithReuseIdentifier: FontCell.reuseIdentifier)
collectionView!.delegate = self
collectionView!.dataSource = self
collectionView!.isPagingEnabled = true
collectionView!.bounces = false
self.collectionView?.reloadData()
}

class FontRound {
let font: UILabel

init(font: UILabel) {
self.font = font
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.datasource.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FontCell.reuseIdentifier, for: indexPath) as! FontCell
cell.array.text = FontCell.nameLabel[indexPath.row]
cell.array.font = self.datasource[indexPath.row]
cell.array.textColor = Theme.Colors.labelText
return cell
}

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = UIScreen.main.bounds.size.width/4
let height = UIScreen.main.bounds.size.width/4
return CGSize(width: width, height: height)
}

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
debugPrint("ciaooooo")

}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
var visibleRect = CGRect()
visibleRect.origin = collectionView!.contentOffset
visibleRect.size = collectionView!.bounds.size
let visiblePoint = CGPoint(x: visibleRect.midX, y: visibleRect.midY)
guard let indexPath = collectionView!.indexPathForItem(at: visiblePoint) else { return }
print(indexPath[1])
self.delegate?.sincronizeScroll(indexPath: indexPath)
}

internal func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if !onceOnly {
collectionView.scrollToItem(at: self.indexPath, at: UICollectionView.ScrollPosition.right, animated: false)
onceOnly = true
}
}
}

final class CollectionFontView: UICollectionView {

init(_ collectionViewLayout: UICollectionViewLayout) {
super.init(frame: .zero, collectionViewLayout: collectionViewLayout)
self.showsHorizontalScrollIndicator = false
register(FontCell.self, forCellWithReuseIdentifier: FontCell.reuseIdentifier)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}











share|improve this question
















I need your help.. I need to be able to move a UITextField with the UITapGestureRecognizer. The textField is inserted in a view, how can I touch it and move it in the View?



And how can I connect my textfield to the color and font buttons, so when I click on one of them I change the color or font to my TextField?



import UIKit
import Foundation
import Constrainable

class FontCell: UICollectionViewCell {
static let reuseIdentifier = "FontCell_RID"

override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}

var cellID: String?

static let nameLabel = ["Little", "Baby", "Kiss", "love", "Sweet", "Happy", "Cuddle", "Pretty", "Smile", "hug", "Mommy", "Daddy"]

var array = UILabel().then{
$0.contentMode = UIView.ContentMode.scaleAspectFit
$0.layer.cornerRadius = (((UIScreen.main.bounds.size.width/8)*0.8)/2)
}

func setupViews(){
self.addSubview(self.array)
self.array.activate([
array.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 0.8),
array.heightAnchor.constraint(equalTo: self.array.widthAnchor),
array.centerXAnchor.constraint(equalTo: self.centerXAnchor),
array.centerYAnchor.constraint(equalTo: self.centerYAnchor),
])
}

func setContents(container: UILabel) {
for sv in self.contentView.subviews {
sv.removeFromSuperview()
}
self.contentView.addSubview(container)
container.activate(constraint(edgesTo: self.contentView))
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

import UIKit
import Constrainable

protocol FontDelegate: class {
func sincronizeScroll(indexPath: IndexPath)
}

class CollectionFont: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
weak var delegate: FontDelegate?
var collectionView: UICollectionView?
let cellSpacing:CGFloat = 1
let indexPath: IndexPath
var datasource: [UIFont] =
var imageArray: Array<UIImageView> =
var onceOnly = false

init(datasource: [UIFont], index: IndexPath = [0,0]) {
self.indexPath = index
self.datasource = Theme.CustomFontsFamily.customFonts
super.init(nibName: nil, bundle: nil)
}

override func viewDidLoad() {
super.viewDidLoad()
collectionView?.delegate = self
collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: UICollectionViewLayout())
collectionView!.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(collectionView!)
collectionView!.activate(constraint(edgesTo: self.view))
collectionView!.backgroundColor = Theme.Colors.sky
let collectionViewFlowLayout = UICollectionViewFlowLayout()
collectionView!.setCollectionViewLayout(collectionViewFlowLayout, animated: true)
collectionViewFlowLayout.scrollDirection = .horizontal
collectionViewFlowLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
collectionViewFlowLayout.minimumLineSpacing = 0
collectionViewFlowLayout.minimumInteritemSpacing = 0
collectionView!.register(FontCell.self, forCellWithReuseIdentifier: FontCell.reuseIdentifier)
collectionView!.delegate = self
collectionView!.dataSource = self
collectionView!.isPagingEnabled = true
collectionView!.bounces = false
self.collectionView?.reloadData()
}

class FontRound {
let font: UILabel

init(font: UILabel) {
self.font = font
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.datasource.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FontCell.reuseIdentifier, for: indexPath) as! FontCell
cell.array.text = FontCell.nameLabel[indexPath.row]
cell.array.font = self.datasource[indexPath.row]
cell.array.textColor = Theme.Colors.labelText
return cell
}

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = UIScreen.main.bounds.size.width/4
let height = UIScreen.main.bounds.size.width/4
return CGSize(width: width, height: height)
}

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
debugPrint("ciaooooo")

}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
var visibleRect = CGRect()
visibleRect.origin = collectionView!.contentOffset
visibleRect.size = collectionView!.bounds.size
let visiblePoint = CGPoint(x: visibleRect.midX, y: visibleRect.midY)
guard let indexPath = collectionView!.indexPathForItem(at: visiblePoint) else { return }
print(indexPath[1])
self.delegate?.sincronizeScroll(indexPath: indexPath)
}

internal func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if !onceOnly {
collectionView.scrollToItem(at: self.indexPath, at: UICollectionView.ScrollPosition.right, animated: false)
onceOnly = true
}
}
}

final class CollectionFontView: UICollectionView {

init(_ collectionViewLayout: UICollectionViewLayout) {
super.init(frame: .zero, collectionViewLayout: collectionViewLayout)
self.showsHorizontalScrollIndicator = false
register(FontCell.self, forCellWithReuseIdentifier: FontCell.reuseIdentifier)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}








ios swift uitextfield






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 3:05









Banghua Zhao

1,285719




1,285719










asked Nov 15 '18 at 22:15







user10660003















  • 1





    If you want to move your UITextField, you can try UIPanGestureRecognizer instead of UITapGestureRecognizer

    – Quoc Nguyen
    Nov 16 '18 at 0:20











  • @QuocNguyen ok, thank you, I try now. instead can you give me some indication on how to hook colors and fonts to the Text? so that it changes color when I press a button?

    – user10660003
    Nov 16 '18 at 8:54














  • 1





    If you want to move your UITextField, you can try UIPanGestureRecognizer instead of UITapGestureRecognizer

    – Quoc Nguyen
    Nov 16 '18 at 0:20











  • @QuocNguyen ok, thank you, I try now. instead can you give me some indication on how to hook colors and fonts to the Text? so that it changes color when I press a button?

    – user10660003
    Nov 16 '18 at 8:54








1




1





If you want to move your UITextField, you can try UIPanGestureRecognizer instead of UITapGestureRecognizer

– Quoc Nguyen
Nov 16 '18 at 0:20





If you want to move your UITextField, you can try UIPanGestureRecognizer instead of UITapGestureRecognizer

– Quoc Nguyen
Nov 16 '18 at 0:20













@QuocNguyen ok, thank you, I try now. instead can you give me some indication on how to hook colors and fonts to the Text? so that it changes color when I press a button?

– user10660003
Nov 16 '18 at 8:54





@QuocNguyen ok, thank you, I try now. instead can you give me some indication on how to hook colors and fonts to the Text? so that it changes color when I press a button?

– user10660003
Nov 16 '18 at 8:54












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328650%2ftextfield-movable-programmatically-swift-4%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328650%2ftextfield-movable-programmatically-swift-4%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)