Getting User Input from TextField [closed] - swift

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm new to swift language and xcode, and I've been stuck on this problem for weeks.
How can I get user input (from a textField) and turn it into a variable that I can use in my code?
Thank you.

All you need to do is:
let userInput = textField.text
Make sure you place the code inside of the function that is called when the user is finished editing.
For example, if you have a confirm button, you would probably want to initialize this variable inside of the function that is called when the user taps the confirm button.

Related

Unity: How To Assign ScriptableObject Instance In Editor Code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 days ago.
Improve this question
Want to access ScriptableObject data from an editor code, namely a custom Node Graph Editor code:
Create a ScriptableObject containing Color field.
Create an instance of that SO and set the Color in the inspector.
Acquire that SO instance from an editor script.(if this was a Monobehavior we could drag drop into a SerializeField, how to achieve this from an editor script?)
Use the color from SO instance.
You can use :
SO SOInstance = Resources.Load("PATH_OF_YOUR_SO");
https://docs.unity3d.com/ScriptReference/Resources.Load.html

Variables across all view controllers [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
In my Login screen, after the login has been accepted, a number is given to that particular user as UserNum so i can access information stored in arrays.
My question is: how can i use this variable across all of my viewControllers to display the information that i get from using my array?
One way to do this is creating a new Swift Files, and make a struct with static variables like this:
struct CommonValues {
static var UserNum: Int = 0
}
And then, you modify it in any view controller if you need it.
You maybe should save it and load it as well, I recommend UserDefaults for that.

Keeping tracking of clicked buttons in vb6? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have an application with multiple forms. One of the forms frmHistory can be accessed from two different forms, frmClient, frmChild by clicking on cmdHISTORY. FrmHistory has a button called cmdBACK on it. What I'm trying to do is, code the cmdBACK button so when frmHistory is accessed from frmClient, upon clicking cmdBACK it would go back to frmClient (same thing from frmChild). How would I go aobut doing it?
This may not be the best answer but it is the way I know how.
I would create a hidden control on the frmHistory, i.e. lblParent. I then assign that frmHistory.lblParent = "frmChild" or frmHistory.lblParent= "frmClient" from frmChild or frmClient. In the frmHistory you check for lblParent to know which form calls it.
I did a similar thing to what KD did.
I created a global variable called g_whichForm. Upon clicking on the HISTORY button in frmParent i made it g_whichForm="Parent" and g_whichForm ="Child" for child. So when I clicked back i check if g_whichForm = parent or child then go back to the correct form.
Thanks!

How to create Android game that if user passed level1 ,user reach to level2 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am beginner .Please help me example code.
I want to explain this problem.
Game has 3Activity.
1.MenuActivity 2.ActivityA 3.ActivityB
MenuActivity has 2 Button for ActovityA and ActivityB.
Button1 for ActivityA always open.But Button2 for
ActivityB can open ,user passed ActivityA .
You need an if statement:
if user.level (Or some custom selector) > 2 {
//button 2 is opened action
}
you need to furthermore explain your question.

How to run this code automatically [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
you are always such an incredible help to me ... but, Im really stumped here.
A basic bond/mortgage calculator that I have worked out using some online refs & a little modification.
how I can make the REPAYMENT value change automatically, as I press the UP | DOWN buttons for the Interest Rate (int_box) & the Loan (maturity_box)... So, a sort of as you change any values the REPAYMENT (answer_box) is adjusting itself.
Ideally, I want to have that each time a value is altered, it should work out the REPAYMENT VALUE ... any help, ideas or guidence greatly appreciated!
In your increase/decrease functions call giveAnAnswer() after you change the value. This will update the repayment each time the up or down buttons are pressed.
Just call giveAnAnswer() inside increaseRATE() and decreaseRATE() methods.
Using HTML events, you can do the onchange() event for when the user changes by typing. Plus, in the Javascript add a function to your buttons to recalculate the price (As mentioned by Yate).
Example onchange(): http://www.w3schools.com/tags/ev_onchange.asp
<input name="Principal" type="text" class="bondtextbox" id="principal_box" value="2550000" onchange="giveAnAnswer()" />
Edit: Made my solution clearer. And added example for Principal textfield.