top滚动

2018-07-30  本文已影响0人  动感大猴子

NSArray *btnTitArray = [NSArray arrayWithObjects:@"关注动态",@"宝贝上新",@"视频直播",@"排行榜", nil];

    _moveView = [[UIView alloc]initWithFrame:CGRectMake(0, 64+48, WIDTH/4, 48)];

    [self.view addSubview:self.moveView];

    for (int i = 0; i< 4; i++) {

        _btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];

        if (i==0)

        {

        [_btn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];

        }else{

      [_btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];

        }

        _btn.tag = 200 +i;

        _btn.frame = CGRectMake(i*(WIDTH/4), 64, WIDTH/4, 48);

        [_btn setTitle:[btnTitArray objectAtIndex:i] forState:UIControlStateNormal];

        [_btn addTarget:self action:@selector(moveClick:) forControlEvents:UIControlEventTouchUpInside];

        [self.view addSubview:self.btn];

上一篇下一篇

猜你喜欢

热点阅读