IOS学习之道:使用UIButton纯手工打造的黑白快小游戏.

由于代码量比较多,有兴趣的同学可以去我的资源页进行下载.
http://download.csdn.net/detail/tx874828503/8637445
//
//  RootViewController.m
//  无极黑白块
//
//  Copyright (c) 2015年 桐花. All rights reserved.
//

#import "RootViewController.h"
#import "GroupButtonViewController.h"
#import "EnterGameViewController.h"

@interface RootViewController ()

@property(strong,nonatomic)GroupButtonViewController *GbuttonVC;
@end

@implementation RootViewController

- (void)dealloc
{
    [_countVC release];
    [_enterGmVC release];
    [_GbuttonVC release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //游戏界面
    self.GbuttonVC = [[GroupButtonViewController alloc]init];
    _GbuttonVC.view.frame = self.view.bounds;
    _GbuttonVC.view.backgroundColor = [UIColor whiteColor];
    [self addChildViewController:_GbuttonVC];
  [self.view addSubview:_GbuttonVC.view];
    //积分器界面
    self.countVC = [[CountViewController alloc]init];
    _countVC.view.frame = self.view.bounds;
    _countVC.view.backgroundColor = [UIColor whiteColor];
    [self addChildViewController:_countVC];
    [self.view addSubview:_countVC.view];
    //登录界面
    self.enterGmVC = [[EnterGameViewController alloc]init];
    _enterGmVC.view.frame = self.view.bounds;
    _enterGmVC.view.backgroundColor = [UIColor whiteColor];
    [self addChildViewController:_enterGmVC];
    
    [self.view addSubview:_enterGmVC.view];
    [_GbuttonVC release];
    [_enterGmVC release];


    
    
}

//进入游戏
-(void)enter{
    [self.view addSubview:self.GbuttonVC.view];
    [self.enterGmVC.view removeFromSuperview];
    
    
}

//重新开始游戏
-(void)returnGame{
   
    [self.countVC.view removeFromSuperview];
    [self.view addSubview:self.GbuttonVC.view];
}

//得分计数器
-(void)lookScore:(NSString *)score gameGrand:(NSString *)gameGrand{
    [self.GbuttonVC.view removeFromSuperview];
    ((Count *)self.countVC.view).labelScore.text = score;//需要强制转换才能访问下一级的view
    ((Count *)self.countVC.view).orderScore.text = gameGrand;
    ((Count *)self.countVC.view).orderScore.font = [UIFont boldSystemFontOfSize:15];
    [self.view addSubview:self.countVC.view];
}

//GameOverbutton的事件调用
-(void)gameOverbutton{
    
    [self.GbuttonVC.view removeFromSuperview];
    [self.view addSubview:self.enterGmVC.view];

}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
使用UIButton纯手工打造的黑白快小游戏.请勿商业使用,转载请注明出处,谢谢
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值