views:

32

answers:

1

Hi all,

I'm looking for a clean way to implement a login screen in my iPhone application. I'd like it to appear as a grouped UITableView section with rounded corners and a separator line below between rows (like e.g. the sections in the Settings app). However, I'd like to give it a slightly smaller cornerRadius than the default setting of a UITableView section.

Another thing I'd like to do in that screen is to add a "register as new user" button which causes the whole screen to slide up, presenting the registration screen. There will be a background image that spans both screens vertically and should slide up with together with the content.

I was first thinking to just make a UITableView, set it to grouped, add two sections (one for login and one for registration), add some space between them and disable manual scrolling on the UITableView. However, I found that putting a background image correctly behind a UITableView and to make that scroll together with its content is a bit tricky..

Perhaps I shouldn't be using a UITableView and just write some code myself that can wrap multiple views (each containing a label and a textfield) together into something that appears like a UITableView section? I've been searching around but surprisingly it appears that not too many others are trying to solve this same problem.

Any suggestions would be very welcome!

A: 

Sounds like a UITableView is overkill for what you need. I would just create a custom UIViewController and have it handle the layout of all of your subviews as well as any animation you desire.

Just have the parent view take up more space than the device's screen. Then, when you want everything to slide up, animate a change to that view's frame property.

Sebastian Celis
Thanks for your answer. I also feel that a UITableView is a bit overkill. What is still unclear to me -and what was my main question- is how to draw a UIView that looks like a UITableView section (including separator lines between the "rows"). Any suggestions?
schuilr
Take a look at the CALayer documentation. You can add a corner radius and borders with that. Thus, you could have 1 view for the entire section that you want to have rounded corners. The separator lines you can draw manually with CoreGraphics.http://stackoverflow.com/questions/1878821/how-to-draw-line-between-two-points
Sebastian Celis