开发者

Represent Number Line in iphone app

开发者 https://www.devze.com 2023-02-23 23:26 出处:网络
I am looking to display number line in my application How this can be done? I a开发者_Go百科lso want to control number like programatically you can use views with different sizes and background colo

I am looking to display number line in my application

Represent Number Line in iphone app

How this can be done? I a开发者_Go百科lso want to control number like programatically


you can use views with different sizes and background colours. Use #define -s for the fixed sizes.

You should have 3 functions: one that draws the horizontal red/blue rects

-(UIView *) drawHorizontal:(CGRect)frame withColor:(UIColor)theColor;

one that draws vertical spacers and labels underneath. Iterate for whole line width.

-(UIView *) drawVertical:(CGPoint)centerPosition withLabel:(int)number;

Your number line should be stored as an NSArray of NSDictionaries containing the position (index) and length of the horizontal red/blue lines.

Hope this helps.


There's no easy standard component to do this. You will need to subclass UIView and override drawRect. Then you can use Core Graphics to draw the number line.

0

精彩评论

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