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

杀马特。学长 韩版系。学妹 提交于 2019-12-20 04:58:13

问题


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

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

来源:https://stackoverflow.com/questions/23617246/xcode-5-ios-7-unlock-levels-when-one-level-is-completed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!