这里是Demo链接: https://github.com/ironCheng/iFill 代码里面有相应的注释,这里懒得写了,有不明白的可以留言。 参考: https://ilearnios.wordpress.com/2013/07/18/scanline-flood-fill-algorithm-with-or-without-tolerance-in-objective-c/