I'm trying to set the Size, Color etc of the section headers in a Tableview.
It appears possible to do this using Objective-C but I can't figure out how.
[Short summary - to save you reading the whole thing, it turns out that you can't do this unless you are prepared to implement all the methods of a TableView in Objective C. ]
I thought it might be possible to replace a Section Header with a Label with this code
but I get this exception when I try it:
I think that I'm sending the message to the wrong object, but not sure.
What am I doing wrong?
It appears possible to do this using Objective-C but I can't figure out how.
[Short summary - to save you reading the whole thing, it turns out that you can't do this unless you are prepared to implement all the methods of a TableView in Objective C. ]
I thought it might be possible to replace a Section Header with a Label with this code
B4X:
Sub ChangeSectionHeader(Table As TableView)
Dim MyView As Label
MyView.Initialize("Section")
MyView.Text="Custom Header"
MyView.Color=Colors.Blue
MyView.Height=60dip
MyView.TextColor=Colors.Red
Try
Dim no As NativeObject = Table
no.RunMethod("willDisplayHeaderView:", Array (True,MyView,0))
Catch
Log(LastException)
End Try
End Sub
but I get this exception when I try it:
<B4IExceptionWrapper: Error Domain=caught_exception Code=0 " Method not found: willDisplayHeaderView:, target: <UITableView: 0x17101600; frame = (357.838 248.686; 328.266 238); clipsToBounds = YES; hidden = YES; gestureRecognizers = <NSArray: 0x16d93b50>; layer = <CALayer: 0x16d8deb0>; contentOffset: {0, 387}; contentSize: {328.26596, 624.84717}>" UserInfo={NSLocalizedDescription= Method not found: willDisplayHeaderView:, target: <UITableView: 0x17101600; frame = (357.838 248.686; 328.266 238); clipsToBounds = YES; hidden = YES; gestureRecognizers = <NSArray: 0x16d93b50>; layer = <CALayer: 0x16d8deb0>; contentOffset: {0, 387}; contentSize: {328.26596, 624.84717}>}>
I think that I'm sending the message to the wrong object, but not sure.
What am I doing wrong?
Last edited: