Thanks for this suggestion, I've looked at this article, and just tried it. I managed to work round most of the issues involving the section numbering by creating a real section header with no header title and no footer title, followed by a table item that is formatted to look like a section header. I also put tags on the table items so that I could distinguish between pseudo-headers and standard table items.
This is my code for setting up a Custom Section Header if anyone is interested:
p_TableView is a Globally defined tableview
objAnchor is a reference TextField used for positioning
Sub InsertHeader(SectionHeader As String)
'This creates an invisible section divider and increments the section number
p_TableView.AddSection("","")
Dim tc As TableCell = p_TableView.AddSingleLine("")
tc.Bitmap=Null
tc.ShowSelection = False
Dim p As Panel
p.Initialize("")
p.Width = objAnchor.Width
p.Height = objAnchor.Height
p.Tag="Header"
Dim Myview As Label
'Can set these as required
Myview.Initialize("Header")
Myview.Text=SectionHeader
Myview.Color=Colors.white
Myview.Height=objAnchor.Height
Myview.TextColor=Colors.Red
p.AddView(Myview,10dip,0,p.Width,p.Height)
tc.CustomView = p
End Sub
One thing that I couldn't manage to achieve however was the effect whereby the current section header appears at the top of the scroll area as you scroll down to later sections.
[Edit added later: I've also discovered an issue when the device is rotated. The Panel and Label in the above example needs to be re-sized and moved. I've had to add code to remember the objects and then to update them in the Page_Resize event. Will update the example at some point]
I still couldn't figure out how to re-format the actual section headers using your Objective-C and my previous guesses.
#If objc
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return anyView;
}
#End If
In the above code anyView is obviously undefined and I wasn't sure what to set it too.