/ Published in: Objective C
Just a random snippet of text nothing special.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
-(IBAction) workOutPasswordsRating:(id)sender; { // Get the current property from the _passwordRating. NSInteger currentRating; currentRating = _passwordRating; NSInteger complexityChoice; complexityChoice = [_passwordComplexity indexOfSelectedItem]; // We need to check to see if anything has been previously set. if (_lastAssignedScore != 0) { // Something was previously set, so deduct that. NSInteger tmp = 0; if (tmp < 0) { _passwordRating = 0; } else { _passwordRating -= _lastAssignedScore; } [_complexityBar setIntegerValue:_passwordRating]; } if (complexityChoice == 0) { _passwordRating += 2; [_complexityBar setIntegerValue:_passwordRating]; _lastAssignedScore = 2; } else if (complexityChoice == 1) { _passwordRating += 1; [_complexityBar setIntegerValue:_passwordRating]; _lastAssignedScore = 1; } else if (complexityChoice == 2) { _passwordRating += 0; [_complexityBar setIntegerValue:_passwordRating]; _lastAssignedScore = 0; } NSLog(@"CURRENT SCORE: %ld", _passwordRating); }