Have a question on how can I update my formula by NSUserDefault. So I have two text field which needs to keep my Formula uptodate. So the user types in there number (value) then that numbers needs to go to my formula but the formula only showing me the distance value :).
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
I think the problem may lie here:
You are writing out to your
NSUserDefaults
directly from yourtextField.text
, often with0.00
formatting, but you are reading it in as anint
. It is stored as aNSString
likely. You should store and read it as aNSNumber
.Going In:
Coming out:
I tried your code with some changes. Here are my
.h
file and.m
files. Try this. Now also I didn't understand what your trying to find out, but this code gives me the values not anan
. While you writing code, don't forget to start your variable name in small letter that is a standard way. And also useself
if you set a variable as property.ViewController.h
ViewController.m
And the result in Simulator is
Don’t forget to connect
delegates
andIBOutlet
from interface builder.