Keep UINavigationBar height with prefersStatusBarHidden - uiviewcontroller

At certain times in my app I am hiding the UIStatusBar on iOS 7.
-(UIStatusBarAnimation)preferredStatusBarUpdateAnimation {
return UIStatusBarAnimationFade;
}
-(BOOL)prefersStatusBarHidden {
if (self.state == StateModal) {
return YES;
}
return NO;
}
However, this the y-origin of the view controller's UINavigationBar. It moves up since there is not UIStatusBar visible, but I would like to retain the height of the status bar, but makes it's content invisible.
Is this possible? I don't have to take iOS 6 into account, just iOS 7.

You can change current window windowLevel to UIWindowLevelStatusBar, when controller is appeared
https://stackoverflow.com/a/21158994/2035054

Related

Transport bar live label in AVPlayerViewController (tvOS only)

It seems impossible to disable or change the red backgrounded LIVE label in the AVPlayerViewController's transport bar on tvOS 15.2. Also, it is enabled by default ever since 15.2 came out. Here is a picture of the label shown here:
I have tried to play around with some of the available options like this one:
guard let pvc = playerRenderController as? AVPlayerViewController else { return }
pvc.transportBarIncludesTitleView = false
It does hide the LIVE label but it also hides the title (Straight Rhythm) from the image.
Furthermore, the label text seems to be specific to the locale, so in Danish it would be DIREKTE instead of LIVE.
Here is a video that showcases this feature (time 03:08):
Any suggestions on how to hide/change this label?
Hello I found a workaround to do it.
After you play the stream call this function with parameters the playerViewController.view
private func removeLiveLabel(view: UIView) {
let list = ["_AVPlayerViewControllerContainerView", "_AVFocusContainerView", "UIView"]
for subview in view.subviews where list.contains(String(describing: type(of: view))) {
for subSubview in subview.subviews {
if subSubview.value(forKey: "class").debugDescription.contains("_AVxOverlayPlaybackAuxiliaryMetadataView") {
subSubview.removeFromSuperview()
return
}
}
removeLiveLabel(view: subview)
}
}
This function will search the subviews of the AVPlayerViewController object controls and will remove the badge from the view without removing the Title.

Why is button not getting disabled using jQuery?

Let me clear first that I checked other answers. They're either too old or not working for me...
I am trying to dynamically disable and enable two navigation buttons using a function:
function arrowDisplayConfig() {
if (modeInSight == 1) {
$("#rightArrow").prop("disabled",false);
$("#leftArrow").prop("disabled",true);
}
if (modeInSight === maxModes) {
$("#rightArrow").prop("disabled",true);
$("#leftArrow").prop("disabled",false);
}
else {
$("#rightArrow").prop("disabled",false);
$("#leftArrow").prop("disabled",false);
}
}
Basically disabling left arrow when its the first item in carousel and right one when its the last item, while keeping both enabled when in-between.
The problem is that this works perfectly for all cases except the first one. Don't know why.
P.S
I increase and decrease the modeInSight integer value in other functions and call this function after it.

How to exit full screen mode in Google maps API

I am programming web page with Google map on it and some markers (points). Markers have some InfoWindows, in InfoWindow is a link to a <div> tag on the same page. Something like
var infowindow = new google.maps.InfoWindow({
content: 'See info'
});
In this way, the user can display InfoWindow on the map, and then the user can display additional information below on the web page.
It works fine. BUT if the map is in FullScreen mode, the link does not work.
If user clicks on the link in the full screen mode, I would like to
Exit full screen mode, and
Scroll to the anchored <div
id="info">
Can somebody help?
I have tested, that if the link goes to another web page, then it works fine even in the FullScreen mode. The problem is only in linking the same page (via #id).
I tweaked my original solution:
I muset set onClick listener to link ant this listener has to handle the two steps: 1) exit full screen mode and 2) scroll to given tag
Exiting full screen mode is done by i) Checking if document is in full screen mode and if yes, then ii) Exit full screen mode.
This must be done for different webkits
function onClickListener(id) {
// Exit Full Screen Mode
if (document.fullscreenElement ) {
document.exitFullscreen();
} else if (document.mozFullScreenElement ) {
document.mozCancelFullScreen();
} else if (document.webkitFullscreenElement ) {
document.webkitExitFullscreen();
} else if (document.msFullscreenElement ) {
document.msExitFullscreen();
}
// Scroll to #id - using jQuery
$('html,body').animate({scrollTop:$('#'+id).offset().top}, 700);
return false;
}

Google Maps AutoComplete dropdown hidden when Google Maps Full Screen is true

I've implemented a google maps with autocomplete onverlayed on the map and I've set the FullScreenControl option to "true" (You can see the FullScreenControl on the right in the image below)
My problem is that when I switch to FullScreen mode by clicking the FullScreenControl, the dropdown is hidden behind the google map.
It seems that the ZIndex is too low but setting it to a very large number does not seem to fix the issue. You can see from the image below that the dropdown exists, but only behind the fullscreen google map.
I did find a similar question with answer where someone used a normal dropdown and not the google map autocomplete.
Similar Question and answer
However the solution didn't work for me.
Setting the ZIndex doesn't seem to work.
I'm using TypeScript with Angular2.
Thank you.
]4
For anyone struggling with this, if the z-index solution is not working:
The Google maps generated div ("pac-container") with the autocomplete options is appended to the body child elements. But when in full screen, only elements inside the target element (the map div) will be shown, so z-index is ignored.
A quick workaround is to move the pac-container div inside the map div when entering full screen, and move it back on exit.
document.onfullscreenchange = function ( event ) {
let target = event.target;
let pacContainerElements = document.getElementsByClassName("pac-container");
if (pacContainerElements.length > 0) {
let pacContainer = document.getElementsByClassName("pac-container")[0];
if (pacContainer.parentElement === target) {
console.log("Exiting FULL SCREEN - moving pacContainer to body");
document.getElementsByTagName("body")[0].appendChild(pacContainer);
} else {
console.log("Entering FULL SCREEN - moving pacContainer to target element");
target.appendChild(pacContainer);
}
} else {
console.log("FULL SCREEN change - no pacContainer found");
}};
i was fix it with add z-index to .pac-container
see here
.pac-container, .pac-item{
z-index: 2147483647 !important;
}
Thank you #vladhorby! I ended up with your solution due to updating z-index not working on my case. I got 1 little bug, somehow that options position not in the right place when on the fullscreen mode. I add little code to fix this thing. The idea is to add a class when in fullscreen mode, and delete that after leave the fullscreen. Hope this can help anyone with the same case.
document.onfullscreenchange = function ( event ) {
let target = event.target;
let pacContainerElements = document.getElementsByClassName("pac-container");
if (pacContainerElements.length > 0) {
let pacContainer = document.getElementsByClassName("pac-container")[0];
if (pacContainer.parentElement === target) {
document.getElementsByTagName("body")[0].appendChild(pacContainer);
pacContainer.className += pacContainer.className.replace("fullscreen-pac-container", "");
} else {
target.appendChild(pacContainer);
pacContainer.className += " fullscreen-pac-container";
}
}
};
and the last thing add this to the your css file:
.fullscreen-pac-container[style]{
z-index: 2547483647 !important;
top:50px !important;
}

Move Window in mfc c++ without titlebar?

I am using this code to move the window. But this code does not work well. When I click anywhere on windows from it will move but i just want to move windows form. When i click on specific think. For example picture. I am using MFC C++ HtmlDialog. Anyone know how to do that?
DHTML_EVENT_ONCLICK(_T("image"), PreTranslateMessage)
BOOL CHtmlDlgTestDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_MOUSEMOVE && (pMsg->wParam & MK_LBUTTON))
{
CPoint p;
GetCursorPos(&p);
CRect r;
GetWindowRect(&r);
if (r.PtInRect(p))
{
ReleaseCapture();
SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, 0);
SendMessage(WM_NCLBUTTONUP, HTCAPTION, 0);
return 1;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
WM_NCLBUTTONDOWN is a notification message, Windows sends this message and the program responds to it. The program should not send this message to Windows. In this case it works but it's not recommended.
I don't know how this code works: DHTML_EVENT_ONCLICK(_T("image"), PreTranslateMessage) it probably gets ignored and you can remove it. PreTranslateMessage is still called. You can restrict it to any rectangle within the Window, for example CRect(50,50,200,200):
BOOL CHtmlDlgTestDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_MOUSEMOVE && (pMsg->wParam & MK_LBUTTON))
{
CPoint p = pMsg->pt;
ScreenToClient(&p);
CRect r(50,50,200,200);
if (r.PtInRect(p))
{
ReleaseCapture();
SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, 0);
SendMessage(WM_NCLBUTTONUP, HTCAPTION, 0);
return 1;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
If you want to move an element within the window you can use javascript:
Moveable/draggable <div>
Ps, normally you should use WM_NCHITTEST as explained earlier. This case is very unusual because it's HTML dialog. You should reconsider putting a normal title bar which users understand, or you could put html control within a dialog, then you can control the rest of the dialog with standard WinApi.