15.小红点和遮罩层

2017-03-09  本文已影响40人  cj2527

小红点

    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(25, 6, 14, 14)];
    label.text = @"1";
    label.font = [UIFont systemFontOfSize:10];
    label.textAlignment = NSTextAlignmentCenter;
    label.backgroundColor = UIColorHex(#DA0851);
    label.textColor = [UIColor whiteColor];
    label.layer.masksToBounds = YES;
    label.layer.cornerRadius = 7.f;
    label.userInteractionEnabled = YES;

二、遮罩层

    UIView *coverView = [[UIView alloc]initWithFrame:self.view.bounds];
    coverView.alpha = 0.5;
    coverView.backgroundColor=[UIColor blackColor];
    [self.view addSubview:coverView];
    self.coverView = coverView;

当透明度为0-0.01时,可以把这个遮罩层当不存在一样,完全可以击穿遮罩层。而安卓因为焦点的问题点击不到遮罩层下面也是和iOS有区别。

上一篇 下一篇

猜你喜欢

热点阅读