效果图例如以下:



一个带删除线的文本标签,继承自UILabel

自绘代码过程例如以下:

1,重写控件的drawRect方法

2,首先得到上下文对象

3,设置颜色,并指定是填充(Fill)模式还是笔刷(Stroke)模式

4,在上下文中指定删除线的起点(含x,y)

5,依据标签文字的字体,确定文字的长度(即将被画的线条的长度)

6,指定删除线的终点(含x,y)

7,渲染到上下文,完毕路径的绘制

iOS_绘制带删除线的Label的更多相关文章

  1. iOS创建带删除线和价钱符号的Label

    效果显示如下: 只需要子类化Label,重写DrawRect()方法即可: #import "MyLabel.h" @implementation MyLabel - (insta ...

  2. 利用canvas绘制带干扰线的验证码

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. python 对过时类或方法添加删除线的方法

    class Cat(Animal): def __init__(self): import warnings warnings.warn("Cat类带删除线了", Deprecat ...

  4. iOS 为label添加删除线

    UILabel *testLabel = [[ UILabel alloc] initWithFrame:CGRectMake(, , , )]; testLabel.numberOfLines = ...

  5. 用python的matplotlib和numpy库绘制股票K线均线和成交量的整合效果(含量化验证交易策略代码)

    在用python的matplotlib和numpy库绘制股票K线均线的整合效果(含从网络接口爬取数据和验证交易策略代码)一文里,我讲述了通过爬虫接口得到股票数据并绘制出K线均线图形的方式,在本文里,将 ...

  6. iOS · UILabel加删除线

    创建自定义子类DeleteLineLabel,继承自UILabel,然后在自定义子类DeleteLineLabel中 方法一(上下文): - (void)drawRect:(CGRect)rect { ...

  7. ios Lable 添加删除线

    遇到坑了: NSString *goodsPrice = @"230.39"; NSString *marketPrice = @"299.99"; NSStr ...

  8. 利用JFreeChart绘制股票K线图完整解决方案

    http://blog.sina.com.cn/s/blog_4ad042e50100q7d9.html 利用JFreeChart绘制股票K线图完整解决方案 (2011-04-30 13:27:17) ...

  9. iOS-属性字符串添加下划线、删除线

    常用到的属性字符串 ///定义属性字符串NSMutableAttributedString *att = [[NSMutableAttributedString alloc]initWithStrin ...

随机推荐

  1. 某dalao贼快的hash?

    #include<map> #include<cstdio> #include<iostream> #include<ext/pb_ds/assoc_cont ...

  2. small test on 5.30 night T1

    数学题使劲推就对了. 让我们设  g(x) = ∑ C(i,x) * b^i ,然后后面验算了一张纸QWQ,懒得再打一遍了,回家我就把这张演算纸补上QWQ,先上代码. #include<cstd ...

  3. BZOJ 3524 [Poi2014]Couriers(可持久化线段树)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3524 [题目大意] 给一个长度为n的序列a.1≤a[i]≤n. m组询问,每次询问一个 ...

  4. POJ 3688 Cheat in the Game(博弈论)

    [题目链接] http://poj.org/problem?id=3688 [题目大意] 有俩人玩一个取石子的游戏,你是裁判. 游戏中有W块石头和N张卡片,卡片上分别写着数字Ai. 玩家随机抽走一张卡 ...

  5. 【贪心】Gym - 100507H - Pair: normal and paranormal

    每次取相邻的两个可以射击的从序列中删除,重复n次. 可以看作括号序列的匹配. #include<cstdio> #include<vector> using namespace ...

  6. 【数论】【快速幂】CODEVS 2952 细胞分裂 2

    裸快速幂取模,背诵模板用. #include<cstdio> using namespace std; typedef long long LL; LL n=,m,q; LL Quick_ ...

  7. ListView控件(上)数据适配器:ListView绑定监听是SetOnItemClickListener

    (一) 1.效果图: 2.MainActivity.java package com.example.app5; import android.support.v7.app.AppCompatActi ...

  8. 使用Python的turtle模块画出最简单的五角星

    代码如下: import turtle def main(): t = turtle.Turtle() t.hideturtle() lengthOfSize = 200 drawFivePointS ...

  9. SQL Server Latch Classes Library

    https://www.sqlskills.com/help/latches/ (Companion SQL Server Wait Types Library) This site lists al ...

  10. oracle表空间操作语句

    1.查看所有表空间及表空间大小: select tablespace_name ,sum(bytes) / 1024 / 1024 as MB from dba_data_files group by ...