Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

iOS QA

1) How to restrict the text in the textfield?

2) Get previous parse data visible after you change the user profile? And make the same data visible when you want to change your settings again. I also want to cache the same values in the phone.

3) How to make it possible to reset som views when you exit them?

4) Create a test user that a new user can interact with before adding realfriends(like Skype, Myspace and Snapchat uses)?

Maybe it a shot in the dark with this questions. But who knows.... :)

2 Answers

1) you can use the shouldChangeCharactersInRange delegate method like so (make sure you set your text fields delegate first, in this case the max number of characters allowed is 30):

    - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    if (textField.text.length >= 30 && range.length == 0) {
        return NO; 
    }
    else {
      return YES;
     }
}

2) you can use NSUserDefaults to save settings on the users phone. see this tutorial on how to use it

4) As far as creating a test user, why not just create another user using whatever sign up form you have then interact with that?

Thanks man!

1) I will try your answer for number 1 looks good! 2) I used that but that problem is that if I log out and then log in again with a new user the same info will be saved(from the phone) for the new user. Any solution? 4) True. Can you get that one as a default for all people who sign up?