iOS 11 Large Titles

iOS 11 introduces large titles.
Documentation

I created a function in a module :

[code]Public Sub setLargeTitles(extends v As iOSView, value As Boolean)

Static sSystemVersion As Double

//Get sSystemVersion only once
if sSystemVersion = 0.0 then

Declare Function NSClassFromString Lib "Foundation" (clsName As CFStringRef) As ptr
Declare Function currentDevice_ Lib "UIKit.framework" selector "currentDevice" (clsRef As ptr) As ptr
Declare Function systemversion_ Lib "UIKit.framework" selector "systemVersion" (obj_id As ptr) As CFStringRef

Dim device As Ptr = currentDevice_(NSClassFromString("UIDevice"))
Dim systemVersion As Text = systemversion_(device)

Try
  sSystemVersion = Double.FromText(systemVersion)
Catch
End Try

End If

//Use new API
If sSystemVersion >= 11.0 Then

Declare Function navigationBar Lib "UIKit.framework" selector "navigationBar" (obj_ref As ptr) As ptr

Declare Function navigationController Lib "UIKit.framework" selector "navigationController" (viewController As ptr) As ptr
Dim navigationControllerRef As ptr = navigationController(v.ViewControllerHandle)

Dim navBar As ptr = navigationBar(navigationControllerRef)

Declare Sub prefersLargeTitles Lib "UIKit.framework" selector "setPrefersLargeTitles:" (obj_id As ptr, value As Boolean)
prefersLargeTitles(navBar, value)

Else
//Not available
End If
End Sub
[/code]

And in an iOSView.Open event, the following code should set the large title:

self.setLargeTitles(true)

Unfortunately it doesn’t work on my iPad with iOS 11.
Is something wrong with my code ?

Nice one. I was wondering how I was going to accomplish this. I hope you get some help with the code so I’m just signing on to watch. :slight_smile:

A few observations and questions:

• It would also be great to support the largeTitleTextAttributes so, for example, the title color can be set
• There’s also a new search controller which appears if the user pulls down — it would be fantastic to be able to support this as well

Supporting the other new features is planned, as soon as I understand why it doesn’t display large titles.

I’m afraid it is the xcode build version in the plist that prevents it from working.

Hi Jean-Paul,

I also tried your suggestion by setting the value to always. But it still doesn’t work

@JrmieLeroy any luck with getting the large titles, et al, to work?