iOS 抽獎轉(zhuǎn)盤動畫

用法:

先添加指針視圖痪伦,轉(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


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市拯刁,隨后出現(xiàn)的幾起案子脊岳,更是在濱河造成了極大的恐慌,老刑警劉巖筛璧,帶你破解...
    沈念sama閱讀 207,113評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件逸绎,死亡現(xiàn)場離奇詭異,居然都是意外死亡夭谤,警方通過查閱死者的電腦和手機棺牧,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,644評論 2 381
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來朗儒,“玉大人颊乘,你說我怎么就攤上這事∽沓” “怎么了乏悄?”我有些...
    開封第一講書人閱讀 153,340評論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長恳不。 經(jīng)常有香客問我檩小,道長,這世上最難降的妖魔是什么烟勋? 我笑而不...
    開封第一講書人閱讀 55,449評論 1 279
  • 正文 為了忘掉前任规求,我火速辦了婚禮,結(jié)果婚禮上卵惦,老公的妹妹穿的比我還像新娘阻肿。我一直安慰自己,他們只是感情好沮尿,可當(dāng)我...
    茶點故事閱讀 64,445評論 5 374
  • 文/花漫 我一把揭開白布丛塌。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪赴邻。 梳的紋絲不亂的頭發(fā)上印衔,一...
    開封第一講書人閱讀 49,166評論 1 284
  • 那天,我揣著相機與錄音乍楚,去河邊找鬼当编。 笑死,一個胖子當(dāng)著我的面吹牛徒溪,可吹牛的內(nèi)容都是我干的忿偷。 我是一名探鬼主播,決...
    沈念sama閱讀 38,442評論 3 401
  • 文/蒼蘭香墨 我猛地睜開眼臊泌,長吁一口氣:“原來是場噩夢啊……” “哼鲤桥!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起渠概,我...
    開封第一講書人閱讀 37,105評論 0 261
  • 序言:老撾萬榮一對情侶失蹤茶凳,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后播揪,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體贮喧,經(jīng)...
    沈念sama閱讀 43,601評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,066評論 2 325
  • 正文 我和宋清朗相戀三年猪狈,在試婚紗的時候發(fā)現(xiàn)自己被綠了箱沦。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,161評論 1 334
  • 序言:一個原本活蹦亂跳的男人離奇死亡雇庙,死狀恐怖谓形,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情疆前,我是刑警寧澤寒跳,帶...
    沈念sama閱讀 33,792評論 4 323
  • 正文 年R本政府宣布,位于F島的核電站竹椒,受9級特大地震影響童太,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜胸完,卻給世界環(huán)境...
    茶點故事閱讀 39,351評論 3 307
  • 文/蒙蒙 一书释、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧舶吗,春花似錦征冷、人聲如沸择膝。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,352評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至腹侣,卻和暖如春叔收,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背傲隶。 一陣腳步聲響...
    開封第一講書人閱讀 31,584評論 1 261
  • 我被黑心中介騙來泰國打工饺律, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人跺株。 一個月前我還...
    沈念sama閱讀 45,618評論 2 355
  • 正文 我出身青樓复濒,卻偏偏與公主長得像,于是被迫代替她去往敵國和親乒省。 傳聞我的和親對象是個殘疾皇子巧颈,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 42,916評論 2 344

推薦閱讀更多精彩內(nèi)容