Return to Snippet

Revision: 50498
at August 24, 2011 23:53 by JonnySnip3r


Initial Code
-(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);
    
}

Initial URL


Initial Description
Just a random snippet of text nothing special.

Initial Title
Objective -C Password Score Thingy

Initial Tags


Initial Language
Objective C