ios - Table Header Views in StoryBoards

ID : 20138

viewed : 27

Tags : iosuitableviewxcode4storyboardios

Top 5 Answer for ios - Table Header Views in StoryBoards

vote vote

96

It looks like one simply drags a control to the top of the table view. I didn't expect it to be that easy.

Before Drop

Before Drop

After Drop

After Drop

vote vote

80

You can do this easily by dragging your UIView/UIImageView just below the UITableView in the document outline (instead of the layout).

If you try to drag in the layout instead of document outline the UITableViewCell will jump to the top handling which is frustrating!

vote vote

77

Dragging and dropping a view on top of the tableview worked for only one screen size, at least in Xcode 11. It didn't size well on different screens.

I just created a view and left it there behind the tableview in storyboard. I created an IBOutlet for it:

@IBOutlet weak var audioView: UIView! 

Then in tableview code I did:

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {     return audioView }  func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {     return 142 } 

It worked well on all screen sizes.

vote vote

63

vote vote

54

as a noob using Python3 ,I find it might be an import error instead of a Django error

wrong:

from someModule import someClass 

right:

from .someModule import someClass 

this happens a few days ago but I really can't reproduce it...I think only people new to Django may encounter this.here's what I remember:

try to register a model in admin.py:

from django.contrib import admin from user import User admin.site.register(User) 

try to run server, error looks like this

some lines... File "/path/to/admin.py" ,line 6 tell you there is an import error some lines... Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label 

change user to .user ,problem solved

Top 3 video Explaining ios - Table Header Views in StoryBoards

Related QUESTION?