Changing part of an iOSSplitView

I’ve got a module method that’s called from lots of views many times to progress through my app:

[code]Public Sub GoToView(mview As iOSView)
If iOSSplitView.Available Then
Dim split As New iOSSplitView

split.Master = mview

Dim detail As New FormView
split.Detail = detail

App.CurrentScreen.Content = split

Else
App.CurrentScreen.Content = mview
End If

End Sub
[/code]

The detail view “FormView” doesn’t change but I want it to update its content. So I would like to figure out a way to do that instead of changing the detail view. Something like:

[code]Public Sub GoToView(mview As iOSView)
If iOSSplitView.Available Then
Self.ParentSplitView.Master = mview
FormView(Self.ParentSplitView.Detail).UpdateForm
Else
App.CurrentScreen.Content = mview
End If

End Sub
[/code]

But “Self” can’t be used in a module method. How does one access the ParentSplitView from a module method?

In one of my apps that uses a SplitView, I keep a weak reference to it in the App class. Could also be in a module.

I can then use

App.SplitView.Master = mView App.SplitView.Detail = mView2

I’m lost as to what App.Splitview is.

It is a Computed property added to the App instance

[code]Public Property SplitView as iOSSplitView
Get
if mSplitView <> nil then
Return iOSSplitView(mSplitView)
end if
End Get

Set
mSplitView = Xojo.Core.WeakRef.create(value)
End Set

End Property
[/code]

Private Property mSplitView as Xojo.Core.WeakRef

App.SplitView is Nil when I try to access it later even though in the App.Open event I do:

[code]Var split As New iOSSplitView

Var master As New CharactersView
split.Master = master

Var detail As New FormView
split.Detail = detail

SplitView = split[/code]
which does set mSplitView properly.

I can’t find in the docs where

Return iOSSplitView(mSplitView)

iOSSplitView can take a parameter. Confused.

[quote=485434:@Art Gorski]I can’t find in the docs where

Return iOSSplitView(mSplitView)

iOSSplitView can take a parameter. Confused.[/quote]
It’s a type cast. Since the actual variable is a Weakref and you want to return a Splitview instance.

To change a view, the only way to do this that I can see (besides PushTo, which isn’t appropriate in my case) is to use:

App.CurrentScreen.Content

Unfortunately, in the case of a splitview, it will change both the master and detail. I wanted to just change the master, so it seems like I am out of luck.

Depending on how many times you change view in the master view, you could also use PushTo and hide the back button using iOSDesignExtensions

Thanks, Jeremie. I change the master view a LOT, as the user steps through a long design sequence.

Then another solution is to design everything in iOS Container Controls.
You can then add them to the view or remove them when they aren’t needed. This would keep the detail view the way it is.

However, I remember a bug that made the app crash when removing a containerControl. I don’t know if it is fixed as I worked around it at the time and never checked again.

My interest in not changing a view if I don’t have to is random crashes in my app that I haven’t been able to track down to a specific thing. I am wondering if there’s a memory leak that eventually causes this as the user pounds on the app.

In other apps, I have a simple view with a Title and iOSTable. So there I just change the title and iOSTableDataSource for the table and keep the same view.