代码库> 菜单> 动态按钮菜单
动态按钮菜单
关注
上传者:yanyan30562185 分类:菜单(Menu)
查看次数:2332 下载次数:198
上传时间:2015-07-02 大小:300 B
- (void)viewDidLoad {
    [super viewDidLoad];
_testMutableArray = [NSMutableArray array];
// Do any additional setup after loading the view, typically from a nib.

NSArray *color = @[RGB_COLOR(115, 136, 193),RGB_COLOR(153, 208, 210),RGB_COLOR(235, 135, 14),RGB_COLOR(66, 110, 179),RGB_COLOR(110, 195, 200),RGB_COLOR(241, 122, 110),RGB_COLOR(218, 96, 36),RGB_COLOR(250, 187, 13),RGB_COLOR(241, 146, 113),RGB_COLOR(28, 78, 147),RGB_COLOR(3, 166, 174),RGB_COLOR(239, 172, 107),RGB_COLOR(16, 54, 103),RGB_COLOR(4, 145, 153),RGB_COLOR(245, 202, 116),RGB_COLOR(46, 117, 85),RGB_COLOR(63, 178, 145),RGB_COLOR(36, 84, 52),RGB_COLOR(94, 150, 139),RGB_COLOR(42, 126, 102),RGB_COLOR(47, 135, 79),RGB_COLOR(115, 136, 193),RGB_COLOR(153, 208, 210),RGB_COLOR(235, 135, 14),RGB_COLOR(66, 110, 179),RGB_COLOR(110, 195, 200),RGB_COLOR(241, 122, 110),RGB_COLOR(218, 96, 36),RGB_COLOR(250, 187, 13),RGB_COLOR(241, 146, 113),RGB_COLOR(28, 78, 147),RGB_COLOR(3, 166, 174),RGB_COLOR(239, 172, 107),RGB_COLOR(16, 54, 103),RGB_COLOR(4, 145, 153),RGB_COLOR(245, 202, 116),RGB_COLOR(46, 117, 85),RGB_COLOR(63, 178, 145),RGB_COLOR(36, 84, 52),RGB_COLOR(94, 150, 139),RGB_COLOR(42, 126, 102),RGB_COLOR(47, 135, 79)];

int count = 20;
for (int index = 0; index < count; index ++) {
SelectView* view = [[SelectView alloc] init];
if (index == 0) {
            view.teamName.text = @"创建Team";
        }else if (index == 1){
            view.teamName.text = @"加入Team";
        }
if (color.count >= count) {
            view.backgroundColor = color[index];
        }else{
            view.backgroundColor = [UIColor colorWithRed:(arc4random()%255)/255.0f green:(arc4random()%255)/255.0 blue:(arc4random()%255)/255.0 alpha:1];
        }
        view.selectButton.index = index;
        [_testMutableArray addObject:view];
        view.selectButton.myBlockButton = ^(BaseButton *button){

NSLog(@"您选择的 index : %ld",(unsigned long)button.index);
            [UIView animateWithDuration:0.25 animations:^{
                view.transform = CGAffineTransformMakeScale(2, 2) ;
                view.alpha = 0.1;
for (UIView *teamView in _testMutableArray) {
if (![teamView isEqual:view]) {
                        teamView.transform = CGAffineTransformMakeScale(0.01, 0.01) ;
                    }
                }
            } completion:^(BOOL finished) {
for (UIView *teamView in _testMutableArray) {
                    teamView.transform = CGAffineTransformMakeScale(1, 1) ;
                    teamView.alpha = 1;
                }
UIView *abc = (UIView *)[self.view viewWithTag:10003];
                [abc removeFromSuperview];

if ([view.teamName.text isEqualToString:@"创建Team"]) {

                }else if ([view.teamName.text isEqualToString:@"加入Team"]){

                }
            }];
        };
    }
}
收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0
提示
sina weixin mail 回到顶部