开发者社区> 问答> 正文

时间轴效果的实现

这是我的效果:screenshot

  CGFloat circularLabelWidth = 10;
        UILabel *circularLabel = [[UILabel alloc] initWithFrame:CGRectMake(CELL_HEIGHT_FOOT_LEFTX/2 - circularLabelWidth/2, Height_Section_Header/2 - circularLabelWidth/2, circularLabelWidth, circularLabelWidth)];
        circularLabel.backgroundColor = self.footPrintTableView.backgroundColor;
        circularLabel.layer.cornerRadius = circularLabelWidth/2;
        circularLabel.layer.masksToBounds = YES;
        circularLabel.layer.borderColor = [UIColor whiteColor].CGColor;
        circularLabel.layer.borderWidth = circularLabelWidth/4;
        [headerLabel addSubview:circularLabel];
主要是他那个圆环,我不知道怎么折腾了。有给点提示吗?

展开
收起
a123456678 2016-07-28 11:48:21 1908 0
1 条回答
写回答
取消 提交回答
  • 构思一下
    1个正方形方块+1个圆环

    开始
    假设cell的背景色为#define CELLBGCOLOR [UIColor colorwith......]

    //1.实现方块,定义方块的长=15 高=15 构造一个透明假象

    UIView *sqView = [[UIView alloc] initWithFrame:CGRectMake(CELL_HEIGHT_FOOT_LEFTX/2 - 15/2, Height_Section_Header/2 - 15/2, 15, 15)];
    sqView.backgroundColor = CELLBGCOLOR;//这里就是为了让其和cell的背景一致啦

    [headerLabel addSubview:sqView];

    //2.添加你的圆环,如何剧中,自己处理下把

            CGFloat circularLabelWidth = 10;
            UILabel *circularLabel = [[UILabel alloc] initWithFrame:CGRectMake(2.5, 2.5, circularLabelWidth, circularLabelWidth)];
            circularLabel.backgroundColor = self.footPrintTableView.backgroundColor;
            circularLabel.layer.cornerRadius = circularLabelWidth/2;
            circularLabel.layer.masksToBounds = YES;
            circularLabel.layer.borderColor = [UIColor whiteColor].CGColor;
            circularLabel.layer.borderWidth = circularLabelWidth/4;

    [sqView addSubview:circularLabel];

    2019-07-17 20:01:18
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
3D动画的菜谱式灯光与云渲染 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载