当前位置: 动力学知识库 > 问答 > 编程问答 >

swift - Creating Profile UI in Storyboard

问题描述:

I am trying to create a profile UI in storyboard, but I stuck with a problem. I need to create "header" like in a twitter app profile, but I don't know how to do it. I tried to put an imageView in prototype cell, but it starting scrolling with the whole tableView (for example, when I am trying to scroll up there an empty space in the top).

Click here to see necessary UI

Any suggestions would be greatly appreciated!

!!! SOLUTION

I found the best solution that fits me. I am away from xCode, so I tried to illustrate it in Sketch.

Click here to see the scheme

You need to setup a containerView inside your ViewController. There will be tableView embed in your containerView. Now, you need to setup your first prototype cell with the height of imageView inside your ViewController. Then, all what you need are couple lines of code :)

let cell = tableView.dequeueReusableCellWithIdentifier("IDOfYourFirstPrototypeCell") as UITableViewCell!

cell.backgroundColor = UIColor.clearColor()

return cell

and in your viewDidLoad function:

tableView.backgroundColor = UIColor.clearColor()

Also, if I doesn't mistake you need to remove background of ContainerView.

In your ViewController's viewDidLoad function:

containerView.backgroundColor = UIColor.clearColor()

Sorry, if there some grammar mistakes in my post :)

网友答案:

You should to get out your profile view from tableView. Try this UI scheme

分享给朋友:
您可能感兴趣的文章:
随机阅读: