Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Title Bar and Objc_util
-
objc_util update?
Header not meant to be missleading lol..
Good morning fellow pythoneers.. im woking on a posters request and my previouse "fix" wasnt quitewhat Post needs. here is the post to save myself some time explaining.. bern at this one all night..
User also mentions they would rather not Override Present for
ui.View
. not sure why really.. but by not doing override and "hard" setting they
ofPageControl.scrollView
we came into issues where if the title_bar i hidden there is a gap 20pt where we set the y value. i went through ALOT of pages on Apple Dev sight and found that some of the class and method calls have moved/changed.. that wasnt fun 😂😅 .. but i did manage to try the following to change StatusBar and fine if it is hidden or not...
i know the StatusBar and Title are not the same but im hopping that they share the same UIControllerwith the Nav View..- Apple Layouts
- Understanding ScrollView
- Safe Area Inset
- Apple Page Control
- Apple UIApplication pretty much every section in here..
- Apple UIStatusBarManager
Some stuff just wouldnt work and for some reason i could find Fields/Variables that should of helped... and even if i set CGRect or CGPoint it would change the values but did nothing to the live objects... i assume i wasnt using the live views controller.
the method that should have worked i thought was:
[[UIApplication sharedApplication] isStatusBarHidden] (python) objc_util.ObjCClass('UIApplication').sharedApplication(). isStatusBarHidden
this would return a boolean but not for current View..
Sorry for the messy post lol tired. and thank you in advance!
-
not sure if this is what you want:
objc_util.UIApplication.sharedApplication().statusBar().hidden=True
(or can use setHidden_(True))
-
@JonB cannot use that anymore
gives this after crashing Pythonista.
2020-04-03 06:26:39.572008 App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window. Use the statusBarManager object on the window scene instead.
All i literaly need to do is do a check at runtime inside ui.View class to see if the titlebar is hidden or not.
isStatusBarHidden
is soposed to be the wy to check but i tjust returns a defaulted False boolean. -
-
@cvp lol well any chance anyone knowsthe method to get if itshidden?
-
feel like i researched all night for nothin lol
-
-
@cvp awesome thank you!
-
@stephen we are in the right way,I hope but not sure
from objc_util import * a = ObjCClass('UIApplication').sharedApplication() for window in a.windows(): print(window.windowScene().statusBarManager().isStatusBarHidden())
Edit: if, in the loop, you add print(window), you will see that the first window is a PA3PythonistaWindow object
-
From a bit of searching it seems like
prefersStatusBarHidden
(source) returns true/false if the view controller is requesting the status bar to be hidden. Not sure if this would work, just thought I would through in what I found. -
-
@stephen try
from objc_util import * a = ObjCClass('UIApplication').sharedApplication() for window in a.windows(): if 'PA3PythonistaWindow' in str(window._get_objc_classname()): #print(dir(window.windowScene().statusBarManager())) print(window.windowScene().statusBarManager().statusBarHeight()) print(window.windowScene().statusBarManager().statusBarHidden()) break
-
-
-
@stephen the checks are about statusBar, not titleBar, no?
-
@cvp no im sorry 😎 i need to check if a mainView has
hide_title_bar
from present() set to true or False after runtime from inside the customeView Class body -
@Samer said:
From a bit of searching it seems like
prefersStatusBarHidden
(source) returns true/false if the view controller is requesting the status bar to be hidden. Not sure if this would work, just thought I would through in what I found.gave
prefersStatusBarHidden
a try and doesnt seem to exist within pythonistas UIView environment -
@stephen said:
i need to check if a mainView has hide_title_bar from present()
I guess your problem is for a sheet only, because if full screen,
the height of the ui.View is
either the screen height (hide_title_bar=True)
either 70 pixels less (hide_title_bar=False). -
@cvp Fullscreen objc scrollview
Normaly Yes but this is tied into this lol and that titlebar is givin me a run for my lunch.. we have done the following so far..- walked SuperViewTree
- Iterated over objc UIApplicstion
- Checked layout for all inset values.
every time i feel close... nothin lol i even think i found a nav view with y set to 70.. but nothingbwith height 70..