开发者

What is the easiest way to generate this UI?

As subject asks, what is the easiest way to achieve the below input form?

What is the easiest way to generate this UI?

Is it using UITableView? Or something else? I tinker around with code a little bit and I think I may be doing more work than I have to. I re开发者_运维问答call a presentation in which the presenter said that if I am doing too much hacking to get a feature, perhaps I am doing it wrong.

I searched the web for several frameworks and they are not sufficient. I tried ELCTextField. I try to use IBAForms which looks really good but the sample code is so confusing, I have no idea on how to use it. If you have any sample code, please share it and I would appreciate it. I also try RoundedUITableView and cannot get that to work.

Links to the frameworks: 1. ELCTextField: http://www.cocoacontrols.com/platforms/ios/controls/elctextfieldcell 2. IBAForms: http://www.cocoacontrols.com/platforms/ios/controls/ibaforms 3. RoundedUITableView: https://github.com/beetlebugorg/RoundedUITableView

PS: When I try to combine RoundedUITableVIew with ELCTextField, everything breaks. It's heartbreaking...


You can do this with two UITextFields set within a container UIView object. You will have to set the borderColor, borderWidth and cornerRadius. I've created some sample code illustrating this.

Basically we will lay the two text fields adjacent vertically inside the container view. We will set the container view's clipsToBounds property to YES. We will assign borders to all the three objects and add a corner radius to the container view to get the effect as a grouped table view.

We will also add rightView and leftView properties of the two UITextField objects to get the padding effect.


I'd suggest a UITableView in grouped (UITableViewStyleGrouped) style, with a UITextField added to the table cell(s). You can use the UITextField's placeholder property to get the gray default text value in the field.


I achieved basically the same effect by having an image as the background (although I guess you could place the content in tableView cells) and having a borderless textfield in each space that had default text in it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜