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 trialcharlie D
5,218 Pointsyes
Alert views don't appear when I click on "sign up" or "login" without entering login or sign up info. I'm using Xcode 5 - not getting any error messages. Any suggestions?
My code is listed below:
-
(IBAction)signup:(id)sender { NSString *username = [self.usernameField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *password = [self.passwordField.text stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSString *email = [self.emailField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ([username length] == 0 || [password length] == 0 || [email length] == 0) { UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@"O0ps!" message:@"Make sure you enter a username, password and email address!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alertview show];
}
} @end
1 Answer
Anthony Rouinvy
10,495 PointsI can't tell you why it doesn't work, but, I took your code, created a new project on XCode 6, iPhone 6 simulator and it does work.
obey me
1,135 Pointsobey me
1,135 PointsThis is a shorter way to do it,I hope it helps