//
// JCAllBuyViewController.m
// 09-彩票-空工程
//
// Created by panba on 16-6-2.
// Copyright (c) 2016年 panba. All rights reserved.
//
#import "JCAllBuyViewController.h"
#import "JCAllCaiZhongButton.h"
@interface JCAllBuyViewController ()
@property (nonatomic,assign,getter=isOpen) BOOL open;
@end
@implementation JCAllBuyViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
// self.title = @"合买跟单";
//1-添加一个button
JCAllCaiZhongButton *btn = [[JCAllCaiZhongButton alloc]init];
btn.frame = CGRectMake(120, 0, 100, 44);
[btn setTitle:@"全部彩种" forState:UIControlStateNormal];
[btn setImage:[UIImage imageNamed:@"YellowDownArrow.png"] forState:UIControlStateNormal];
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.navigationController.navigationBar addSubview:btn];
}
//2-设置小三角旋转的事件
-(void)btnClicked:(UIButton *)titleBtn
{
if (!self.isOpen) {
[UIView animateWithDuration:1 animations:^{
titleBtn.imageView.transform = CGAffineTransformMakeRotation(M_PI);
}];
self.open = YES;
}
else
{
[UIView animateWithDuration:1 animations:^{
titleBtn.imageView.transform = CGAffineTransformIdentity;
}];
self.open = NO;
}
}
@end