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

Anybody an idea on how to show a new view controller if the alert is validated? (objective c)

instead of a button i'd like to change the view controller if a alert is validated but i've no idea how to do is. I use a cocoa pod for the notification (just cause the design is beautiful). every answer is welcome!

  • (IBAction)changeTheme:(UIButton *)sender {

    // for changing view controller [UIView animateKeyframesWithDuration:1.0 delay:0 options:0 animations:^{ changeTheme.transform = CGAffineTransformMakeScale(2, 2); } completion:^(BOOL finished) {

    // init alert with options
    SCLAlertView *changeThemeNotification = [[SCLAlertView alloc] init];
    
    // to sport
    [changeThemeNotification addButton:@"change to sport" validationBlock:^BOOL{
        BOOL passedValidation = true;
        return passedValidation;
    } actionBlock:^{
    
    }];
    // to food
    [changeThemeNotification addButton:@"change to food" validationBlock:^BOOL{
        BOOL passedValidation = true;
         return passedValidation;
    } actionBlock:^{
        [self.view setBackgroundColor:[UIColor blackColor]];
    }];
    
    // to animal
     [changeThemeNotification addButton:@"change to animal" validationBlock:^BOOL{
         BOOL passedValidation = true;
         return passedValidation;
     } actionBlock:^{
         [self.view setBackgroundColor:[UIColor greenColor]];
     }];
    
      // else (message & options)
    [changeThemeNotification showCustom:self image:nil color:[self.colorWheel randomColor] title:@"Test" subTitle:@"This is a test notification for the navigation." closeButtonTitle:@"stay" duration:0.0f];
    changeThemeNotification.hideAnimationType = SlideOutToBottom;
    changeThemeNotification.shouldDismissOnTapOutside = YES;
    changeThemeNotification.soundURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/url_to_sound.mp3", [[NSBundle mainBundle] resourcePath]]];
    

    }]; }