Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Intro to iOS] Pre-work - Review my app #1

Open
hoaknoppix opened this issue Aug 8, 2015 · 6 comments
Open

[Intro to iOS] Pre-work - Review my app #1

hoaknoppix opened this issue Aug 8, 2015 · 6 comments

Comments

@hoaknoppix
Copy link
Owner

/cc @chug2k
My app is complete, please review and give me some comments. :)
Thanks.

@chug2k
Copy link

chug2k commented Aug 8, 2015

Thanks for your submission! You've satisfied the basic requirements, but you could make some improvements.

For your loadTipPercentage, I think your problem is that you never call saveTipPercentage. You should call it in viewWillDisappear, and loadTipPercentage should look something like:

        var defaults :NSUserDefaults = NSUserDefaults.standardUserDefaults()
        tipPercentage = defaults.floatForKey("tip_percentage")
        if tipPercentage == 0 {
            tipPercentage == 5.0
        }
        textBoxTipPercentage.text = "\(tipPercentage)"

Please try to fix your submission.

Thank you,
Charles

@hoaknoppix
Copy link
Owner Author

Thank Charles, It's so ridiculous for this mistake. However, I have tried like your suggestion and it doesn't work as well. The save method, it gets the correct new value, but when the app run again, it always gets the old value. :(

@chug2k
Copy link

chug2k commented Aug 11, 2015

I am a bad teacher. I gave you bad advice - sorry! My mistake.

viewWillDisappear is not called when the application quits, so instead of in viewWillDisappear, call your saveTipPercentage method when the you didFinishEditing on the tip field.

@hoaknoppix
Copy link
Owner Author

It works now Charles. Thank you so much! 👍
Btw, is it true that there is no event for application exiting in xCode? It should be like the android, I think.

@chug2k
Copy link

chug2k commented Aug 13, 2015

There actually is:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html#//apple_ref/occ/intfm/UIApplicationDelegate/applicationWillResignActive
:

-Charles

On Wed, Aug 12, 2015 at 9:27 AM hoaknoppix [email protected] wrote:

It works now Charles. Thank you so much! [image: 👍]
Btw, is it true that there is no event for application exiting in xCode?
It should be like the android, I think.


Reply to this email directly or view it on GitHub
#1 (comment).

@chug2k
Copy link

chug2k commented Aug 21, 2015

Hello,

You may have missed my emails - I've sent you an email about course details from [email protected]. Please check your spam mailbox?

Thanks,
Sáng

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants