Posts

Post not yet marked as solved
0 Replies
258 Views
Hey what's up everybody. A long time without connecting here. I'm pretty sure my trouble is not a new topic but I still having this trouble each time I want to sign my email. Do someone know how to solucionaste the problem of the image that disappears from the signature mail. I still using the apple mail platform... Thx
Posted Last updated
.
Post not yet marked as solved
2 Replies
620 Views
Hello everyoneI have tried some things, but still blocked with my project.In one view, I have 3 different pickerviews, and I need them connected but with different dataset. I explain with an example.On the first pickerview the user selects the trademark of a car (example: Ferrari, Porsche...), and then depending on the trade selected, I need to display on the second pickerview, the models of the kind of car (example if Porsche selected: 911, Carrera, Cayman...), continuing on this way, I need the third pickerview to display the years of fabrication of this model of car selected.How can I do this selection of different datas depending on the data selected on the previous pickerview?
Posted Last updated
.
Post marked as solved
3 Replies
792 Views
Hi everyone,today I have another question. When I select the decimal pad to enter only numbers onto a text field, if I press twice or more the comma, the textfield doesn't limitate to one comma. And my code doesn't work because it doesn't recognize the number. How can I do to limitate to one comma entry in the textfield?
Posted Last updated
.
Post marked as solved
2 Replies
265 Views
Hi everyoneI'm trying to make two conditions on a textfield that I have put on an alarm message.First condition is that the OK button is disabled till a value is entered on the textfield. (this is fixed, I do like a counter of characters in the textfield)Second condition es that the OK button still disabled if the user enter the value 0.I don't know how to make this. The button must enable when the value entered on textfield is > 0.Here is the code for first condition:ok.isEnabled = false alertMessage.addAction(ok) alertMessage.addTextField { (textField) -> Void in amountTextField = textField amountTextField?.placeholder = "Introduzca un valor" amountTextField?.keyboardType = UIKeyboardType.numberPad let toolBar = UIToolbar() toolBar.sizeToFit() let doneButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.done, target: self, action: #selector(self.doneClicked)) toolBar.setItems([doneButton], animated: false) amountTextField?.inputAccessoryView = toolBar NotificationCenter.default.addObserver(forName: .UITextFieldTextDidChange, object: textField, queue: OperationQueue.main, using: {_ in let textCount = textField.text?.trimmingCharacters(in: .whitespacesAndNewlines).characters.count ?? 0 let textIsNotEmpty = textCount > 0 ok.isEnabled = textIsNotEmpty }) } self.present(alertMessage, animated: true, completion: nil)Thanks for any help.
Posted Last updated
.
Post marked as solved
2 Replies
397 Views
Hi everybodyI have a code that works properly (see below) but I want to add a thing.Now to change the value on TextField2 I need to enter every time a value on TextField1. What I'm looking for is to keep value on TextField1 and obtain different values on TextField2 by changing values on PickerViews 1 and/or 2.import UIKit class ConversorDistanciaSubViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate, UITextFieldDelegate { @IBOutlet weak var textField1: UITextField! @IBOutlet weak var textField2: UITextField! @IBOutlet weak var labelField1: UILabel! @IBOutlet weak var labelField2: UILabel! @IBOutlet weak var pickerView1: UIPickerView! @IBOutlet weak var pickerView2: UIPickerView! let udd1 = 0 let udd2 = 0 let distances = ["Milímetro", "Centímetro", "Metro", "Kilómetro", "Yardas", "Pulgada", "Pie", "Milla", "Milla Náutica"] let abreviaturas = ["mm", "cm", "m", "km", "yd", "in", "ft", "mi", "nmi"] @IBAction func textField1EntryValue(_ sender: UITextField) { var udd1 = Double(textField1.text!) var udd2 = Double(textField2.text!) if (udd1 != nil) { // Primera medida Milímetros if (labelField1.text == labelField2.text) { textField2.text = textField1.text } if (labelField1.text == "mm") { if (labelField2.text == "cm") { let udd2 = udd1!*0.1 textField2.text = String(udd2) } if (labelField2.text == "m") { let udd2 = udd1!*0.001 textField2.text = String(udd2) } if (labelField2.text == "km") { let udd2 = udd1!*0.000001 textField2.text = String(udd2) } if (labelField2.text == "yd") { let udd2 = udd1!*0.00109361 textField2.text = String(udd2) } if (labelField2.text == "in") { let udd2 = udd1!*0.0393701 textField2.text = String(udd2) } if (labelField2.text == "ft") { let udd2 = udd1!*0.00328084 textField2.text = String(udd2) } if (labelField2.text == "mi") { let udd2 = udd1!*0.00000062137 textField2.text = String(udd2) } if (labelField2.text == "nmi") { let udd2 = udd1!*0.00000053996 textField2.text = String(udd2) } } // Segunda medida Centímetros if (labelField1.text == "cm") { if (labelField2.text == "mm") { let udd2 = udd1!*10 textField2.text = String(udd2) } if (labelField1.text == "m") { let udd2 = udd1!*1 textField2.text = String(udd2) } if (labelField2.text == "km") { let udd2 = udd1!*0.00001 textField2.text = String(udd2) } if (labelField2.text == "yd") { let udd2 = udd1!*0.0109361 textField2.text = String(udd2) } if (labelField2.text == "in") { let udd2 = udd1!*0.393701 textField2.text = String(udd2) } if (labelField2.text == "ft") { let udd2 = udd1!*0.0328084 textField2.text = String(udd2) } if (labelField2.text == "mi") { let udd2 = udd1!*0.0000062137 textField2.text = String(udd2) } if (labelField2.text == "nmi") { let udd2 = udd1!*0.0000053996 textField2.text = String(udd2) } } // Tercera medida Metros if (labelField1.text == "m") { if (labelField2.text == "mm") { let udd2 = udd1!*1000 textField2.text = String(udd2) } if (labelField2.text == "cm") { let udd2 = udd1!*100 textField2.text = String(udd2) } if (labelField2.text == "km") { let udd2 = udd1!*0.001 textField2.text = String(udd2) } if (labelField2.text == "yd") { let udd2 = udd1!*1.09361 textField2.text = String(udd2) } if (labelField2.text == "in") { let udd2 = udd1!*39.3701 textField2.text = String(udd2) } if (labelField2.text == "ft") { let udd2 = udd1!*3.28084 textField2.text = String(udd2) } if (labelField2.text == "mi") { let udd2 = udd1!*0.00062137 textField2.text = String(udd2) } if (labelField2.text == "nmi") { let udd2 = udd1!*0.00053996 textField2.text = String(udd2) } } // Cuarta medida Kilómetro if (labelField1.text == "km") { if (labelField2.text == "mm") { let udd2 = udd1!*1000000 textField2.text = String(udd2) } if (labelField2.text == "cm") { let udd2 = udd1!*100000 textField2.text = String(udd2) } if (labelField2.text == "m") { let udd2 = udd1!*1000 textField2.text = String(udd2) } if (labelField2.text == "yd") { let udd2 = udd1!*1093.61 textField2.text = String(udd2) } if (labelField2.text == "in") { let udd2 = udd1!*39370.1 textField2.text = String(udd2) } if (labelField2.text == "ft") { let udd2 = udd1!*3280.84 textField2.text = String(udd2) } if (labelField2.text == "mi") { let udd2 = udd1!*0.62137 textField2.text = String(udd2) } if (labelField2.text == "nmi") { let udd2 = udd1!*0.53996 textField2.text = String(udd2) } } // Quinta medida Yarda if (labelField1.text == "yd") { if (labelField2.text == "mm") { let udd2 = udd1!*914.4 textField2.text = String(udd2) } if (labelField2.text == "cm") { let udd2 = udd1!*91.44 textField2.text = String(udd2) } if (labelField2.text == "m") { let udd2 = udd1!*0.9144 textField2.text = String(udd2) } if (labelField2.text == "km") { let udd2 = udd1!*0.0009144 textField2.text = String(udd2) } if (labelField2.text == "in") { let udd2 = udd1!*36 textField2.text = String(udd2) } if (labelField2.text == "ft") { let udd2 = udd1!*3 textField2.text = String(udd2) } if (labelField2.text == "mi") { let udd2 = udd1!*0.000568182 textField2.text = String(udd2) } if (labelField2.text == "nmi") { let udd2 = udd1!*0.000493737 textField2.text = String(udd2) } } // Sexta medida Pulgada if (labelField1.text == "in") { if (labelField2.text == "mm") { let udd2 = udd1!*25.4 textField2.text = String(udd2) } if (labelField2.text == "cm") { let udd2 = udd1!*2.54 textField2.text = String(udd2) } if (labelField2.text == "m") { let udd2 = udd1!*0.0254 textField2.text = String(udd2) } if (labelField2.text == "km") { let udd2 = udd1!*0.0000254 textField2.text = String(udd2) } if (labelField2.text == "yd") { let udd2 = udd1!*0.0277778 textField2.text = String(udd2) } if (labelField2.text == "ft") { let udd2 = udd1!*0.0833333 textField2.text = String(udd2) } if (labelField2.text == "mi") { let udd2 = udd1!*0.000015783 textField2.text = String(udd2) } if (labelField2.text == "nmi") { let udd2 = udd1!*0.000013715 textField2.text = String(udd2) } } // Séptima medida Pie if (labelField1.text == "ft") { if (labelField2.text == "mm") { let udd2 = udd1!*304.8 textField2.text = String(udd2) } if (labelField2.text == "cm") { let udd2 = udd1!*30.48 textField2.text = String(udd2) } if (labelField2.text == "m") { let udd2 = udd1!*0.3048 textField2.text = String(udd2) } if (labelField2.text == "km") { let udd2 = udd1!*0.0003048 textField2.text = String(udd2) } if (labelField2.text == "yd") { let udd2 = udd1!*0.333333 textField2.text = String(udd2) } if (labelField2.text == "in") { let udd2 = udd1!*12 textField2.text = String(udd2) } if (labelField2.text == "mi") { let udd2 = udd1!*0.000189394 textField2.text = String(udd2) } if (labelField2.text == "nmi") { let udd2 = udd1!*0.000164579 textField2.text = String(udd2) } } // Octava medida Milla if (labelField1.text == "mi") { if (labelField2.text == "mm") { let udd2 = udd1!*1609340 textField2.text = String(udd2) } if (labelField2.text == "cm") { let udd2 = udd1!*160934 textField2.text = String(udd2) } if (labelField2.text == "m") { let udd2 = udd1!*1609.34 textField2.text = String(udd2) } if (labelField2.text == "km") { let udd2 = udd1!*1.60934 textField2.text = String(udd2) } if (labelField2.text == "yd") { let udd2 = udd1!*1760 textField2.text = String(udd2) } if (labelField2.text == "in") { let udd2 = udd1!*63360 textField2.text = String(udd2) } if (labelField2.text == "ft") { let udd2 = udd1!*5280 textField2.text = String(udd2) } if (labelField2.text == "nmi") { let udd2 = udd1!*0.868976 textField2.text = String(udd2) } } // Novena medida Milla Náutica if (labelField1.text == "nmi") { if (labelField2.text == "mm") { let udd2 = udd1!*1852000 textField2.text = String(udd2) } if (labelField2.text == "cm") { let udd2 = udd1!*185200 textField2.text = String(udd2) } if (labelField2.text == "m") { let udd2 = udd1!*1852 textField2.text = String(udd2) } if (labelField2.text == "km") { let udd2 = udd1!*1.852 textField2.text = String(udd2) } if (labelField2.text == "yd") { let udd2 = udd1!*2025.37 textField2.text = String(udd2) } if (labelField2.text == "in") { let udd2 = udd1!*72913.4 textField2.text = String(udd2) } if (labelField2.text == "ft") { let udd2 = udd1!*6076.12 textField2.text = String(udd2) } if (labelField2.text == "mi") { let udd2 = udd1!*1.15078 textField2.text = String(udd2) } } else if (udd1 == nil) { textField2.text = "0" } } } func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { let invalidCharacters = CharacterSet(charactersIn: ".0123456789").inverted return string.rangeOfCharacter(from: invalidCharacters, options: [], range: string.startIndex ..< string.endIndex) == nil } override func viewDidLoad() { super.viewDidLoad() pickerView1.delegate = self pickerView1.dataSource = self pickerView2.delegate = self pickerView2.dataSource = self textField1.delegate = self textField2.delegate = self textField1.keyboardType = .numberPad textField2.keyboardType = .numberPad //********* IMPLEMENTAMOS UNA BARRA CON EL BOTON Done EN EL TECLADO DEL IPHONE ************ let toolBar = UIToolbar() toolBar.sizeToFit() let doneButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.done, target: self, action: #selector(self.doneClicked)) toolBar.setItems([doneButton], animated: false) textField1.inputAccessoryView = toolBar textField2.inputAccessoryView = toolBar } @objc func doneClicked() { view.endEditing(true) } //********************************************************************* //********** FUNCIONES QUE DEFINEN A LOS PICKERVIEW ********** func numberOfComponents(in pickerView: UIPickerView) -> Int { return 1 } func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { return distances[row] } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { return distances.count } func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { if pickerView == pickerView1 { labelField1.text = abreviaturas[row] } else if pickerView == pickerView2 { labelField2.text = abreviaturas[row] } } //**************************************************** }I know my code is long, but don't know yet how to manage Arrays.Thanks for your help guys.
Posted Last updated
.
Post not yet marked as solved
6 Replies
505 Views
Good afternoonI want to make a drop down menu animated. I succeed in unhiding the buttons, but can't succeed in make the drop down animation. I'm missing something. Some help please?When I press botonDropDown, I want all the buttons to drop down.Here is the code:import UIKit extension UIView { func addBottomBorderWithColor(color: UIColor, width: CGFloat) { let border = CALayer() border.backgroundColor = color.cgColor border.frame = CGRect(x: 0, y: self.frame.size.height - width, width: frame.size.width, height: width) self.layer.addSublayer(border) } func addLeftBorderWithColor(color: UIColor, width: CGFloat) { let border = CALayer() border.backgroundColor = color.cgColor border.frame = CGRect(x: 0, y: 0, width: width, height: self.frame.size.height) self.layer.addSublayer(border) } func addRightBorderWithColor(color: UIColor, width: CGFloat) { let border = CALayer() border.backgroundColor = color.cgColor border.frame = CGRect(x: frame.size.width - width, y: 0, width: width, height: self.frame.size.height) self.layer.addSublayer(border) } func addTopBorderWithColor(color: UIColor, width: CGFloat) { let border = CALayer() border.backgroundColor = color.cgColor border.frame = CGRect(x: 0, y: 0, width: frame.size.width, height: width) self.layer.addSublayer(border) } } class ViewController: UIViewController { @IBOutlet weak var botonLong: UIButton! @IBOutlet weak var botonVolum: UIButton! @IBOutlet weak var botonMasa: UIButton! @IBOutlet weak var botonTemp: UIButton! @IBOutlet weak var botonVeloc: UIButton! @IBOutlet weak var botonCaudal: UIButton! @IBOutlet weak var botonPoten: UIButton! @IBOutlet weak var botonPresion: UIButton! @IBOutlet weak var botonPropDown: UIButton! @IBOutlet var measureSelected: [UIButton]! // in this UICollectionView, I have dragg all the buttons from the Main.storyboard override func viewDidLoad() { super.viewDidLoad() botonPropDown.addBottomBorderWithColor(color: UIColor.white, width: 3) botonLong.addBottomBorderWithColor(color: UIColor.white, width: 1) botonLong.addRightBorderWithColor(color: UIColor.white, width: 1) botonVolum.addBottomBorderWithColor(color: UIColor.white, width: 1) botonVolum.addLeftBorderWithColor(color: UIColor.white, width: 1) botonVolum.addRightBorderWithColor(color: UIColor.white, width: 1) botonMasa.addBottomBorderWithColor(color: UIColor.white, width: 1) botonMasa.addLeftBorderWithColor(color: UIColor.white, width: 1) botonMasa.addRightBorderWithColor(color: UIColor.white, width: 1) botonTemp.addBottomBorderWithColor(color: UIColor.white, width: 1) botonTemp.addLeftBorderWithColor(color: UIColor.white, width: 1) botonVeloc.addTopBorderWithColor(color: UIColor.white, width: 1) botonVeloc.addRightBorderWithColor(color: UIColor.white, width: 1) botonCaudal.addTopBorderWithColor(color: UIColor.white, width: 1) botonCaudal.addRightBorderWithColor(color: UIColor.white, width: 1) botonCaudal.addLeftBorderWithColor(color: UIColor.white, width: 1) botonPoten.addTopBorderWithColor(color: UIColor.white, width: 1) botonPoten.addLeftBorderWithColor(color: UIColor.white, width: 1) botonPoten.addRightBorderWithColor(color: UIColor.white, width: 1) botonPresion.addTopBorderWithColor(color: UIColor.white, width: 1) botonPresion.addLeftBorderWithColor(color: UIColor.white, width: 1) } // in this IBAction I have dragged all buttons from Main.storyboard @IBAction func propDownPressed(_ sender: UIButton) { measureSelected.forEach { (button) in UIView.animate(withDuration: 0.3, animations: { button.isHidden = !button.isHidden self.view.layoutIfNeeded() }) } } Thanks for the help.
Posted Last updated
.
Post marked as solved
8 Replies
557 Views
Hellohere I am again.I need help again.I'm changing a value into the textfield1 using the slider1.And I have another textfield2 with slider2.In textfield1 I introduce radius value of a circle. And in textfield2 I obtain the diameter of the circle.But if I change value in textfield2, automatically the value in textfield1 changes.Now I want the thumb of each slider to move alone if I change the values of each textfield and also if I move manually the thumb of one slider.How can I do it?I don't succeed in doing that.Thanks
Posted Last updated
.
Post marked as solved
3 Replies
1.6k Views
Hi everyone,I'm programming my first App with XCode. And I have now a little problem.My App start with a view controller where I have put some buttons.And I have after a tab bar controller already done.But when I link one button of the View Controller to the Tab Bar Controller, I don't succeed in selecting a specific view of the Tab Bar Controller.My idea is to select button1 and the App will display the View1 of the Tab Bar, and if Button2 is selected, display view2 of tabbar.I didn't found any tutotrial clearly explain about how to manage this.Can someone explain me step by step how to fix this issue?Many thanks.Regards
Posted Last updated
.
Post marked as solved
4 Replies
584 Views
Hi everybody.I'm fascinating with app world. I'm not programmer and want to start initiating to this world with XCode.The first app I want to build for myself is the following:A front image fixed (that won't move) with some transparent cases to see datas printed on a rear image. And the idea is to scroll the rear image to show on the front transparent cases, different datas (printed on the rear image).Can you give me some help with my simple idea.I tried to look at some tutorials on youtube, but don't finish to fix this.Thank you so much.
Posted Last updated
.