开发者

How to draw a simple line without using Interface Builder in iphone sdk?

I开发者_开发百科 want to draw a simple line in view controller with out using Interface builder.


If you only want to draw horizontal or vertical line, you can just use UIView.

UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(<startingX>, <startingY>, <width>, <height>)];
lineView.backgroundColor = <desiredColor>;

//assume self is UIViewController or its sublcass
[self.view addSubview:lineView];
[lineView release];


Try this question. I know this references InterfaceBuilder, but you can dynamically add your custom view using Obj-C like mentioned here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜