开发者

Most effective way of drawing 4 lines in an iPhone app?

开发者 https://www.devze.com 2022-12-31 22:19 出处:网络
basic question, but I\'m unsure. Not looking for code as an answer. I want to draw 4 short lines 1px lines on a view. What is the best way to approach this task? Options:-

basic question, but I'm unsure. Not looking for code as an answer.

I want to draw 4 short lines 1px lines on a view. What is the best way to approach this task? Options:-

  • Load an image of the line, then create 4 UIImageViews with it.
  • Create my own subclass of a UIView that d开发者_StackOverflow社区raws a line in the draw rect method.
  • Draw elsewhere on another view, another UIImageView that has an UIImage inside it (is this possible?)
  • Another way?

Thanks Ross


Simplest way is to create a UIView subclass and perform your drawing in drawRect:. See the CoreGraphics guide for details on how to draw a line.


Quick and dirty way to achieve this is to just create a UIView and set it's height (or width, depending on its orientation) to 1px, and then set a background colour and slap it onto your view as a subview.

0

精彩评论

暂无评论...
验证码 换一张
取 消