Xcode 5 - ios 7 - Unlock Levels when one level is

2019-03-03 06:57发布

I have the main viewcontrols with 3 levels (3 x UIButtons) . The first one is visible while the other two are hidden.

The second and third levels are going to be visible just when the previous level is completed.

For example in level 1 when i chose the right question level 2 button became visible and so on.

here an example

enter image description here

Is there a simple way to achieve this? I am new to xcode and I just cannot figure out how to connect the continue button to unhide the level.

here the link with the project file.

http://salvonostrato.com//ex/xcode5/TESTlevels2.zip

Any help is appreciated

In ViwController.h i have:

#import <UIKit/UIKit.h>
#import "Levell1ViewController.h"

@interface ViewController : UIViewController {

    IBOutlet UIButton *level1;

    IBOutlet UIButton *level2;
    IBOutlet UIButton *level3;

}

-(IBAction)unhide:(id)sender;

@end

then in ViewControl.m I have implemented

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

-(IBAction)unhide:(id)sender{

    level2.hidden = NO;
    level3.hidden = NO;

    }
}



-(IBAction)hide:(id)sender{

    level2.hidden = YES;
    level3.hidden = YES;

    }
}

In Livell1ViewControl.h i have called a button

#import <UIKit/UIKit.h>

@interface Levell1ViewController : UIViewController

@property (nonatomic, weak) UIButton *nextlevel2;
@end

The result does not have any issues however, it crashes when the load.

here the upgraded project

http://salvonostrato.com//ex/xcode5/TESTlevels2.zip

0条回答
登录 后发表回答