Popover resizing erraticly - uitabbarcontroller

I have a UITabBarController inside a UIPopoverController, which I am displaying solely from one UIBarButtonItem. When shown I want the popover to take up the maximum vertical height allowed. It works fine if I tap to display it, then dismiss, and then rotate. However if I have the popover displayed in landscape, and then rotate to portrait, it no longer will fill the entire vertical distance. I have the tab bar controller's content size property set to 320 by 1000, and I have even tried resetting this every time the device rotates. Worse yet, when the user activates the search bar the popover shrinks up extremely small, and stays that way until the app is restarted.
http://cl.ly/3JdC to http://cl.ly/3JdC
Also http://cl.ly/3JVF
How can I stop this, and have the popover always fill up the max vertical size?

I was just having the same problem and found out that it only happens when I present the UIPopoverController using the method:
- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
but it works fine when I use:
- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
Unfortunately UIBarButtonItem does not have a frame Rect you can use with this last method so my fix was to use the UIToolbar's frame and modify frame.origin.x and frame.size.width accordingly to make the popover appear on the right place next to the UIBarButtonItem.
Hopefully Apple will fix this in next releases of iOS.
Regards

Related

Marquee (scrolling) Text in SwiftUI

I am having difficulties implementing the marquee (scrolling) text view in SwiftUI. The problem is that the text needs to stay in the original (0) position for 2 seconds and the starts moving to the left, show up on the right and continue scrolling until the 0 position and wait for 2 seconds again.
You can work with what's in this video to get something working, but honestly it's difficult to make it work with varying screen sizes if your view is in any way responsive. But if you are using the foundation in that video for the animations and combining that with a geometry reader to get your zero position and rightmost entry point position, you could get the scroll positioning correct.
As for starting and stopping, I would suggest you use a Timer to toggle a boolean #State variable called scrollText to start/stop the animation 2 seconds after its duration. You would start by first toggling the animation in .onAppear, like this:
Text("Hello World")
.offset(x: scrollText ? zeroPoint : screenEntryPoint)
.animation(Animation.linear(duration: 8).repeatForever(autoreverses: false))
.onAppear {
self.scrollText.toggle()
}
If you then set a timer for 10 seconds to toggle scrollText, you would be able to get the animation to run for 8s, pause 2 seconds, and then run again.
Please note that to make marquee text work, you also need to REPEAT the text twice, so that the text will animate in from the right while it's also leaving from the left. Good luck!

Qt5.4/QML: How to determine wether the orientation of the screen is inverted or not

I'm creating a iOS video camera app using Qt5.4.
For this I need to determine the current orientation of the device to rotate the video in the VideoOutput element.
As we can see there's a autoOrientation property but it doesn't work as I expect: if I keep switching the orientation it starts to have a weird behaviour i.e. setting the wrong orientation.
Then I tried to apply the rotation based on the Screen.primaryOrientation property:
Copying the function defined in this example, I've a created a similar version, which you can find here.
I call it every time width or height changes, like this:
onWidthChanged: { video.orientation = changeOrientation(); }
onHeightChanged: { video.orientation = changeOrientation(); }
However, it seems that the Inverted orientations are completely ignored, which is strange since they are listed in the documentation.
Anyone has any idea about why it's happening?
UPDATE:
I could isolate the problem when using autoOrientation, basically there's a menu on top of the VideoOutput, the menu is a RowLayout, it's visible only if the user clicks on the menu icon, and only if the user clicks on the menu icon the orientation gets messy.
However, in any situation the InvertedPortrait is not recognized.

Having trouble keeping my CToolBar subclass sized correctly

My objective is to have a CToolBar derivative which has a single control on it (a CMFCShellTreeCtrl).
Something like:
class CFileTreeBar : public CToolBar
Whenever it is asked to compute its size, I want to respond that it is either a fixed minimum, or the size of the client area of the dock bar to which it is docked. In other words, it should consume the entire height of the dock bar + a fixed width (this is being docked on the left - exactly as Explorer lays out its folder tree on the left).
Hence, in CFileTreeBar::CalcFixedLayout it responds with height based on GetParent()->GetWindowRect(rect), and a width of 250pix.
Then in OnSize, the CFileTreeBar resizes its CMFCShellTreeCtrl to consume our client rect (maximizes our only control).
This works beautifully for when the control bar is initially displayed. And it works great when resizing the window by dragging a corner. The CaclFixedLayout returns a different value from its previous value (because the window size changed) and so it computes that it should consume the entire vertical space and eventually I get an WM_SIZE message telling my control bar to resize, which causes me to update the size of the CMFCShellTreeCtrl.
Where I am struggling is when hitting "maximize" button on the CFrameWnd. In this case, for reasons I don't really understand, the CalcFixedLayout is called but the dock bar has its old size (it hasn't been updated to the new sized based on being maximized yet). This causes my code to respond that the size should be the same as it was previously - which causes MFC frame work to not issue a resize (we're already the size we claim we need to be).
Hence, a moment later the dock bar is expanded to consume the whole vertical space, but my control bar and its underlying shell tree are not resized - but left behind with the stale size.
The problem happens also when going from maximized to restored. At that point the call to CalcFixedLayout indicates that we should be as tall as the maximized window (its current size), and now the frame work kicks off the resizing code which ends up making us larger than the dock bar (once it is resized down to restored size), and we disappear below the bottom of the dock bar (clipped by it's maximum vertical extent).
Questions
Is there a good tutorial or white paper showing the overview of how dockbars and control bars are supposed to interact in MFC? i.e. a complete description of how this frame work is supposed to hang together properly? Understanding how these pieces fit together and are intended to work coherently would go a long way towards avoiding hacking it to work, allowing me to write something round to fit the round hole, so to speak.
Is there an example project similar to this that anyone is aware of? Having to figure this junk out is incredibly time consuming - if there is an example somewhere which does this, then that would be great...
Dockable and resizable toolbar is quite complicated to code, there is one in codeproject which is quite good. You can study the source code to see how the author do it.
http://www.codeproject.com/Articles/6/CSizingControlBar-a-resizable-control-bar

Grid does not animate from collapsed to visible

I'm currently trying to make a grid that animates from collapsed -> visible to notify the user that the save has been completed. In Blend 4 I opened the project and created a usercontrol for the SaveNotifier so I can use it in other areas of this project and others. I created the default to be collapsed and also created another state called "Complete" which has visibility set to Visible and has a timetrigger of 3 seconds which sends it back to the default state. The transitions are set to transition over 1 second and use fluidlayout to show the animation between the states, but it does not show the animation between states. Instead it just shows it as if there was no fluidlayout or transition time.
If someone would be so kind as to let me know if there is a problem with trying to do this or even show me how to do this it would be gre
Not sure why, but when I put the grid inside of a new grid it started working. Seems as if you need to have a grid to be the full size for the animation to display.

Prevent zoom in CDHTMLDialog (BHO on IE)

I have a CDHTMLDialog running in IE that has a fixed size that I chose, and runs in a fixed window to match this size.
My problem is that the user can zoom on it (by ctrl-mousewheel) causing my html to be larger or smaller than the window which looks awkward and adds annoying scrollbars. Also, the user might use ctrl-+ or ctrl-- to change the html size, which also causes my CDHTMLDialog to become larger or smaller (though only on navigation after changing size).
Anyone maybe has an idea on how to prevent all zooms on the CDHTMLDialog, including wheel and ctrl-+?
Found it :)
Upon document complete I run the following:
CComVariant vZoom = 100;
m_pBrowserApp->ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DODEFAULT,&vZoom, NULL);
Which resets zoom in my DHTMLDialog to 100%.
Source: Here