用法:
先添加指針視圖痪伦,轉(zhuǎn)盤背景和開始按鈕。按鈕的點擊事件里設(shè)置開始動畫椭微,在動畫開始的代理方法中讓開始按鈕不響應(yīng)點擊事件隐绵,在動畫結(jié)束的代理方法中彈出中獎結(jié)果并讓開始按鈕響應(yīng)點擊事件之众。
- (void) beginRoundRotate {
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[anim setFromValue:[NSNumber numberWithFloat:M_PI*2 * orign]];
orign = randoms / ITEM_COUNT ;
[anim setToValue:[NSNumber numberWithFloat:M_PI * 2*( ROTATION_EXTEND +orign)]];
//-M_PI*2/ITEM_COUNT
//ROTATION_EXTEND +
anim.duration = ANIM_TIME;
anim.removedOnCompletion = NO;
anim.fillMode = kCAFillModeForwards;
[anim setDelegate:self];
[anim setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[_btnIndex.layer addAnimation:anim forKey:@"rotation"];
}
具體代碼:
.h代碼
#import@interface SAViewController : UIViewController
/** 旋轉(zhuǎn)的位置 */
@property (nonatomic, strong) UISegmentedControl *segmentedItem;
/** 旋轉(zhuǎn)的方向 */
@property (nonatomic, strong) UISegmentedControl *segmentedDirection;
/** 提示文本 */
@property (nonatomic, strong) UILabel *lblResult;
/** 底盤 */
@property (nonatomic, strong) UIImageView *imgRound;
/** 指針 */
@property (nonatomic, strong) UIButton *btnIndex;
/** 觸發(fā)的按鈕 */
@property (nonatomic, strong) UIButton *DidBtns;
@property (nonatomic ,strong) NSString *ZhuanPanturn;
@end
.m代碼
//#import "SAViewController.h"
#import "CCActivityHUD.h"
#import "ZhongjiangDetailViewController.h"
const static CGFloat ANIM_TIME = 3.0; // 動畫時間
const static CGFloat ROTATION_EXTEND = 10; // 旋轉(zhuǎn)圈數(shù)延長 // 2 * M_PI = 1圈
const static NSInteger ITEM_COUNT = 7; // 轉(zhuǎn)盤等比分割
@interface SAViewController (){
UIScrollView *bigScrollView;
UIAlertView *alert;
float randoms; // 位置,
float orign; // 角度
UILabel *JX_Lab;
//獎項展示
UILabel *_oneLab;
UILabel *_twoLab;
UILabel *_threeLab;
UILabel *_fourLab;
UILabel *_fiveLab;
UILabel *_sixLab;
UILabel *_SevenLab;
//具體獎項
UILabel *_oneDetailLab;
UILabel *_twoDetailLab;
UILabel *_threeDetailLab;
UILabel *_fourDetailLab;
UILabel *_fiveDetailLab;
UILabel *_sixDetailLab;
UILabel *_SevenDetailLab;
//聲明
UILabel *_shengmingLab;
}
@property (strong, nonatomic) CCActivityHUD *activityHUD;
@end
@implementation SAViewController
-(void)loadView
{
[super loadView];
[self.navigationController setNavigationBarHidden:NO animated:YES];
return;
}
-(void)viewWillAppear:(BOOL)animated{
[self requFenPei];
}
-(void)requFenPei{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager GET:JiangXiangFenpPeiUrl parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id? _Nullable responseObject) {
NSDictionary *content = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
NSLog(@"content==%@",content);
_ZhuanPanturn = content[@"consume"];
//獎項分配顯示
if ([content[@"error"]integerValue]==1) {
_oneDetailLab.text = content[@"data"][@"a"];
_twoDetailLab.text = content[@"data"][@"b"];
_threeDetailLab.text = content[@"data"][@"c"];
_fourDetailLab.text = content[@"data"][@"d"];
_fiveDetailLab.text = content[@"data"][@"e"];
_sixDetailLab.text? = content[@"data"][@"f"];
_SevenDetailLab.text =content[@"data"][@"g"];
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
}];
}//點擊
-(void)request{
[self.activityHUD show];
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager GET:ChouJiangUrl parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
//pp/turn/get_v? 確認(rèn)轉(zhuǎn)盤
//? ? ? ? 返回:? switch,1容許,0不容許
//? ? ? ? prize? 獎項? 1234567
//
//? ? ? ? $return['error']=0;
//? ? ? ? $return['msg']="您的余額不足依许,請及時充值棺禾!";
} success:^(NSURLSessionDataTask * _Nonnull task, id? _Nullable responseObject) {
[self.activityHUD dismiss];
NSDictionary *content = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
NSLog(@"content==%@",content);
if ([content[@"error"]integerValue]==1)
{
if (content[@"prize"] != nil) {
randoms = [content[@"prize"] intValue]-1 ;
//? ? ? ? ? ? ? ? NSLog(@"randoms is %f",randoms);
[self beginRoundRotate];
}
}else{
_DidBtns.userInteractionEnabled = YES;
alert = [[UIAlertView alloc]initWithTitle:@"提示"
message:content[@"msg"]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alert show];
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[self.activityHUD dismiss];
alert = [[UIAlertView alloc]initWithTitle:@"提示"
message:@"網(wǎng)絡(luò)連接錯誤"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alert show];
}];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.activityHUD = [CCActivityHUD new];
self.activityHUD.isTheOnlyActiveView = NO;
self.title = @"幸運大轉(zhuǎn)盤";
self.view.backgroundColor = [UIColor whiteColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.automaticallyAdjustsScrollViewInsets = NO;
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:108/255.0 green:254/255.0 blue:244/255.0 alpha:1];
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSFontAttributeName:[UIFont systemFontOfSize:19],NSForegroundColorAttributeName:[UIColor? whiteColor]}];
//
//? ? UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:(UIBarButtonItemStyleDone) target:self action:nil];
//? ? self.navigationItem.backBarButtonItem = backItem;
UIBarButtonItem *button = [[UIBarButtonItem alloc]initWithImage:nil style:(UIBarButtonItemStyleDone) target:self action:@selector(pushAction)];
[button setTitle:@"中獎紀(jì)錄"];
self.navigationItem.rightBarButtonItem = button;
//? ? self.navigationController.navigationBar.barTintColor = MainColor;
//? ? [self.navigationController.navigationBar setTitleTextAttributes:
//? ? @{NSFontAttributeName:MainFont(19),NSForegroundColorAttributeName:[UIColor? whiteColor]}];
//? ? UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:(UIBarButtonItemStyleDone) target:self action:nil];
//? ? self.navigationItem.backBarButtonItem = backItem;
bigScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
bigScrollView.bounces = NO;
bigScrollView.contentSize = CGSizeMake(KScreenWidth, KScreenHeight+150);
//? ? bigScrollView.scrollEnabled = YES;
bigScrollView.showsVerticalScrollIndicator = YES;
[self.view addSubview:bigScrollView];
//
//? ? NSInteger orign_Y = 660;
////? ? [bigScrollView setContentSize:CGSizeMake(0, orign_Y)];
//
//? ? int width = [UIScreen mainScreen].bounds.size.height;
//
//? ? if (orign_Y < width) {
//
//? ? ? ? bigScrollView.scrollEnabled = NO;
//? ? }else
//? ? {
//? ? ? ? bigScrollView.scrollEnabled = YES;
//? ? }
UIImageView *bgImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"beiji"]];
bgImg.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight*2);
bgImg.userInteractionEnabled = YES;
[bigScrollView addSubview:bgImg];
_shengmingLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 67, KScreenWidth-20, 15)];
_shengmingLab.text = @"聲明:? 本次抽獎活動與蘋果公司無關(guān)";
_shengmingLab.textColor = [UIColor redColor];
_shengmingLab.font = [UIFont systemFontOfSize:15];
_shengmingLab.textAlignment = NSTextAlignmentCenter;
[bgImg addSubview:_shengmingLab];
[self addView];
[self initUI];
}
-(void)pushAction
{
ZhongjiangDetailViewController * zhongjiang = [[ZhongjiangDetailViewController alloc]init];
[self.navigationController pushViewController:zhongjiang animated:NO];
}
/** 添加控件 */
- (void) addView {
//? ? _imgRound = [[UIImageView alloc]initWithFrame:CGRectMake(10, 74, MainScreen_width-20, MainScreen_width-20)];
_imgRound = [[UIImageView alloc]initWithFrame:CGRectMake(KScreenWidth/2-150, 80+10, 300, 300)];
_imgRound.image = [UIImage imageNamed:@"zhuanpan"];
[bigScrollView addSubview:_imgRound];
_btnIndex = [UIButton buttonWithType:UIButtonTypeCustom];
_btnIndex.frame = CGRectMake(KScreenWidth/2-30, 110+80+10, 60, 80);
[_btnIndex setImage:[UIImage imageNamed:@"zhen-1"] forState:UIControlStateNormal];
_btnIndex.adjustsImageWhenHighlighted = NO;
[bigScrollView addSubview:_btnIndex];
//觸發(fā)的按鈕
_DidBtns = [UIButton buttonWithType:UIButtonTypeCustom];
_DidBtns.frame = CGRectMake(KScreenWidth/2-30, 374+10+20, 60, 60);
_DidBtns.userInteractionEnabled = YES;
_DidBtns.backgroundColor = [UIColor clearColor];
[_DidBtns setImage:[UIImage imageNamed:@"anniu"] forState:UIControlStateNormal];
[_DidBtns addTarget:self action:@selector(didClick) forControlEvents:UIControlEventTouchUpInside];
[bigScrollView addSubview:_DidBtns];
UILabel *qLab = [[UILabel alloc]initWithFrame:CGRectMake(KScreenWidth/2-50, 374+10+10+60+6+13, 100, 15)];
qLab.font = [UIFont systemFontOfSize:14];
qLab.text = @"點擊啟動";
qLab.textColor = [UIColor redColor];
qLab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:qLab];
JX_Lab = [[UILabel alloc]initWithFrame:CGRectMake(KScreenWidth/2-50, 394+60+15+10+19, 100, 15)];
JX_Lab.font =[UIFont systemFontOfSize:16];
JX_Lab.text = @"獎項說明";
JX_Lab.textColor = [UIColor grayColor];
JX_Lab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:JX_Lab];
}
//初始化UI
-(void)initUI
{
int interval_x = KScreenWidth/2-140;
int interval_y = 394+60+15+10+10+25;
int interval_detail_x = KScreenWidth/2-80;
_oneLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_x, interval_y, 60, 30)];
_oneLab.text = @"一等獎:";
_oneLab.textColor = [UIColor whiteColor];
_oneLab.font = [UIFont systemFontOfSize:16];
_oneLab.backgroundColor = [UIColor clearColor];
_oneLab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:_oneLab];
//一等獎獎項
_oneDetailLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_detail_x, interval_y, 60, 30)];
//? ? _oneDetailLab.text = @"2000";
_oneDetailLab.textColor = [UIColor grayColor];
_oneDetailLab.font = [UIFont systemFontOfSize:16];
_oneDetailLab.textAlignment = NSTextAlignmentCenter;
_oneDetailLab.backgroundColor = [UIColor clearColor];
[bigScrollView addSubview:_oneDetailLab];
_threeLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_x, interval_y+40, 60, 30)];
_threeLab.text = @"三等獎:";
_threeLab.textColor = [UIColor whiteColor];
_threeLab.font = [UIFont systemFontOfSize:16];
_threeLab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:_threeLab];
//三等獎獎項
_threeDetailLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_detail_x, interval_y+40, 60, 30)];
//? ? _threeDetailLab.text = @"500";
_threeDetailLab.textColor = [UIColor grayColor];
_threeDetailLab.font = [UIFont systemFontOfSize:16];
_threeDetailLab.textAlignment = NSTextAlignmentCenter;
_threeDetailLab.backgroundColor = [UIColor clearColor];
[bigScrollView addSubview:_threeDetailLab];
_fiveLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_x, interval_y+80, 60, 30)];
_fiveLab.text = @"五等獎:";
_fiveLab.textColor = [UIColor whiteColor];
_fiveLab.font = [UIFont systemFontOfSize:16];
_fiveLab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:_fiveLab];
//五等獎獎項
_fiveDetailLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_detail_x, interval_y+80, 60, 30)];
//? ? _fiveDetailLab.text = @"100";
_fiveDetailLab.textColor = [UIColor grayColor];
_fiveDetailLab.font = [UIFont systemFontOfSize:16];
_fiveDetailLab.textAlignment = NSTextAlignmentCenter;
_fiveDetailLab.backgroundColor = [UIColor clearColor];
[bigScrollView addSubview:_fiveDetailLab];
int interval_r_x = KScreenWidth/2+20;
int interval_detail_r_x = KScreenWidth/2+80;
_twoLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_r_x, interval_y, 60, 30)];
_twoLab.text = @"二等獎:";
_twoLab.textColor = [UIColor whiteColor];
_twoLab.font = [UIFont systemFontOfSize:16];
_twoLab.backgroundColor = [UIColor clearColor];
_twoLab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:_twoLab];
//二等獎獎項
_twoDetailLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_detail_r_x, interval_y, 60, 30)];
//? ? _twoDetailLab.text = @"1000";
_twoDetailLab.textColor = [UIColor grayColor];
_twoDetailLab.font = [UIFont systemFontOfSize:16];
_twoDetailLab.textAlignment = NSTextAlignmentCenter;
_twoDetailLab.backgroundColor = [UIColor clearColor];
[bigScrollView addSubview:_twoDetailLab];
_fourLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_r_x, interval_y+40, 60, 30)];
_fourLab.text = @"四等獎:";
_fourLab.textColor = [UIColor whiteColor];
_fourLab.font = [UIFont systemFontOfSize:16];
_fourLab.backgroundColor = [UIColor clearColor];
_fourLab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:_fourLab];
//四等獎獎項
_fourDetailLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_detail_r_x, interval_y+40, 60, 30)];
//? ? _fourDetailLab.text = @"200";
_fourDetailLab.textColor = [UIColor grayColor];
_fourDetailLab.font = [UIFont systemFontOfSize:16];
_fourDetailLab.textAlignment = NSTextAlignmentCenter;
_fourDetailLab.backgroundColor = [UIColor clearColor];
[bigScrollView addSubview:_fourDetailLab];
_sixLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_r_x, interval_y+80, 60, 30)];
_sixLab.text = @"六等獎:";
_sixLab.textColor = [UIColor whiteColor];;
_sixLab.font = [UIFont systemFontOfSize:16];
_sixLab.backgroundColor = [UIColor clearColor];
_sixLab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:_sixLab];
//六等獎獎項
_sixDetailLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_detail_r_x, interval_y+80, 60, 30)];
//? ? _sixDetailLab.text = @"50";
_sixDetailLab.textColor = [UIColor grayColor];;
_sixDetailLab.font = [UIFont systemFontOfSize:16];
_sixDetailLab.textAlignment = NSTextAlignmentCenter;
_sixDetailLab.backgroundColor = [UIColor clearColor];
[bigScrollView addSubview:_sixDetailLab];
//? interval_x, interval_y,
//? ? interval_detail_x, interval_y+40
_SevenLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_x, interval_y+120, 60, 30)];
_SevenLab.text = @"七等獎:";
_SevenLab.textColor = [UIColor whiteColor];;
_SevenLab.font = [UIFont systemFontOfSize:16];
_SevenLab.backgroundColor = [UIColor clearColor];
_SevenLab.textAlignment = NSTextAlignmentCenter;
[bigScrollView addSubview:_SevenLab];
//六等獎獎項
_SevenDetailLab = [[UILabel alloc]initWithFrame:CGRectMake(interval_detail_x, interval_y+120, 60, 30)];
//? ? _sixDetailLab.text = @"50";
_SevenDetailLab.textColor = [UIColor grayColor];;
_SevenDetailLab.font = [UIFont systemFontOfSize:16];
_SevenDetailLab.textAlignment = NSTextAlignmentCenter;
_SevenDetailLab.backgroundColor = [UIColor clearColor];
[bigScrollView addSubview:_SevenDetailLab];
}
/** 模擬從服務(wù)器請求結(jié)果 */
#warning 這里是數(shù)據(jù)請求
- (void) getResult {
// 產(chǎn)生隨機數(shù)峭跳,作為停止項
// 這里從0開始 0-ITEM_COUNT-1
//? ? randoms = (arc4random() % ITEM_COUNT)+1;
NSLog(@"----%f",randoms);
//? ? randoms = 5+1;
_lblResult.text = [NSString stringWithFormat:@"停止項=%.0lf", randoms];
NSLog(@"停止項是:%f",randoms);
[self beginRoundRotate];
}
//觸發(fā)抽獎動畫的按鈕
-(void)didClick
{
_DidBtns.userInteractionEnabled = NO;
NSString *mess? = [NSString stringWithFormat:@"您將消耗%@金幣",_ZhuanPanturn];
UIAlertController *alertview = [UIAlertController alertControllerWithTitle:@"提示" message:mess preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self request];
}];
[alertview addAction:cancel];
[self presentViewController:alertview animated:YES completion:nil];
//? ? [self getResult];
}
/** 開始旋轉(zhuǎn)-底盤 */
- (void) beginRoundRotate {
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[anim setFromValue:[NSNumber numberWithFloat:M_PI*2 * orign]];
orign = randoms / ITEM_COUNT ;
[anim setToValue:[NSNumber numberWithFloat:M_PI * 2*( ROTATION_EXTEND +orign)]];
//-M_PI*2/ITEM_COUNT
//ROTATION_EXTEND +
anim.duration = ANIM_TIME;
anim.removedOnCompletion = NO;
anim.fillMode = kCAFillModeForwards;
[anim setDelegate:self];
[anim setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[_btnIndex.layer addAnimation:anim forKey:@"rotation"];
}
/** 動畫開始 */
- (void)animationDidStart:(CAAnimation *)anim {
[self.activityHUD dismiss];
_btnIndex.userInteractionEnabled = NO;
_segmentedItem.userInteractionEnabled = NO;
_segmentedDirection.userInteractionEnabled = NO;
_DidBtns.userInteractionEnabled = NO;
}
/** 動畫結(jié)束 */
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {
[self.activityHUD dismiss];
_btnIndex.userInteractionEnabled = YES;
_segmentedItem.userInteractionEnabled = YES;
_segmentedDirection.userInteractionEnabled = YES;
_DidBtns.userInteractionEnabled = YES;
int a ;
a = (int)randoms+1;
NSString *mesStr = [NSString stringWithFormat:@"你抽中%d等獎", a];
NSLog(@"mesStr is %@--%d",mesStr,a);
if ([mesStr isEqualToString:@"你抽中1等獎"]) {
if (!alert) {
alert = [[UIAlertView alloc]initWithTitle:@"恭喜"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
}
alert.message = @"你抽中了一等獎";
[alert show];
}else if ([mesStr isEqualToString:@"你抽中2等獎"]) {
if (!alert) {
alert = [[UIAlertView alloc]initWithTitle:@"恭喜"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
}
alert.message = @"你抽中了二等獎";
[alert show];
}else if ([mesStr isEqualToString:@"你抽中3等獎"]) {
if (!alert) {
alert = [[UIAlertView alloc]initWithTitle:@"恭喜"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
}
alert.message = @"你抽中了三等獎";
[alert show];
}else if ([mesStr isEqualToString:@"你抽中4等獎"]) {
if (!alert) {
alert = [[UIAlertView alloc]initWithTitle:@"恭喜"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
}
alert.message = @"你抽中了四等獎";
[alert show];
}else if ([mesStr isEqualToString:@"你抽中5等獎"]) {
if (!alert) {
alert = [[UIAlertView alloc]initWithTitle:@"恭喜"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
}
alert.message = @"你抽中了五等獎";
[alert show];
}else if ([mesStr isEqualToString:@"你抽中6等獎"]) {? //錯開一位膘婶,"抽中0等獎",展示1
if (!alert) {
alert = [[UIAlertView alloc]initWithTitle:@"恭喜"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
}
alert.message = @"你抽中了六等獎";
[alert show];
}else if ([mesStr isEqualToString:@"你抽中7等獎"]) {? //錯開一位蛀醉,"抽中0等獎"悬襟,展示1
if (!alert) {
alert = [[UIAlertView alloc]initWithTitle:@"恭喜"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
}
alert.message = @"你抽中了七等獎";
[alert show];
}
}
-(void)viewWillDisappear:(BOOL)animated{
[self.activityHUD dismiss];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end