效果图:

屏幕快照 2015-02-11 下午2.52.20.png

参考代码:

UILabel *contentLabel = [[UILabel alloc]init];
    contentLabel.textColor = [UIColor whiteColor];
    contentLabel.backgroundColor = [UIColor clearColor];
    //contentLabel.textAlignment = NSTextAlignmentCenter;//设置内容对齐
    contentLabel.font = [UIFont boldSystemFontOfSize:13.0];
    contentLabel.text = @"123456789";
    CGSize size = [contentLabel.text  sizeWithFont:contentLabel.font constrainedToSize:CGSizeMake(80, 100) lineBreakMode:NSLineBreakByWordWrapping];
    UIImage* image = [UIImage imageNamed:@"Point.png"];

    //选取图片的某一像素进行放大做文字背景
    image = [image stretchableImageWithLeftCapWidth:20 topCapHeight:15];
    contentLabel.frame = CGRectMake(15, 4, size.width, size.height);
    UIImageView* updateImage = [[UIImageView alloc]initWithFrame:CGRectMake(320-30-size.width, 150, 30+size.width ,10+size.height )];
    updateImage.image = image;
    [updateImage addSubview:contentLabel];
    [self.view addSubview:updateImage];

附加上那个图片资源:point.png

Point@2x.png




☟☟可点击下方广告支持一下☟☟

最后修改:1970 年 01 月 01 日
请我喝杯可乐,请随意打赏: ☞已打赏列表