PDFView backgroundColor when using usePageViewController - ios11

when I set the usePageViewController on my PDFView instance
pdfView?.usePageViewController(true, withViewOptions: nil)
I can no longer set the backgroundColor with
pdfView?.backgroundColor =.red
I have to(I assume) set it at the pageViewController level.
Question is how to access the pageViewController as it is not a property on the pdfView?
Also what options can be set in the usePageViewController(true, withViewOptions: ???). Be super handy of can set backgroundColor there.

Immediately after you call usePageViewController, the subviews of the PDF View will still be a UIScrollView. However if you wait for it to switch to the page view controller, then you can set the background color of that view.
In my case, I was loading the document I am displaying in viewDidLoad, and I set the background color in viewDidAppear by accessing the subview of the pdf View, for example:
self.pdfView?.subviews[0].backgroundColor = UIColor.red
I would add appropriate checks to make sure that the view is there and that it is actually a page view controller view, just in case Apple's implementation changes in the future.
Regarding your other question about the options passed to usePageViewController - those don't appear to be documented yet.

Related

How to set grid column title in dynamic way without using refresh function

I got requirement to set column title per condition.
No Grid method allows me to set column title after table gets rendered.
I tried with setting new title via manipulating its value in options.
But after that, I'll need to call refresh() method to show my new title.
Because in the grid, I always have some columns hidden dynamically.
Refresh() method will make these hidden columns showing again on the screen and I don't want it.
So, is there a way to set new value to column title?
Thanks.
For hiding individual columns, you can use the hideColumn, showColumn and isHidden methods.
You can also use the visible column property to set column visibility at initialization time.
There is no setTitle() method currently implemented, but you can email Shield UI's support and ask them to implement that for you. Depending on their load, they might do it real quick.
Until that is implemented, you can always update the title by using jQuery.

Configuring bottom bar in QLPreviewController

I have integrated QLPreviewController and UIDocumentInteractionController in my app, and it is working fine.
The only problem is- I want to configure the bottom toolbar, I want to remove the default toolbar items, which appear as shown in image below:
Is there any way to do so, please suggest.
Short Answer: NO, Not in IOS6+
Description:
One thing to note about QLPreviewController is that it's not meant to be customized. There were other libraries allowing you to change the functionality such as:
https://github.com/rob-brown/RBFilePreviewer
Which are not working in iOS 6+ since apple made a big change in QLPreviewController and it's technically running in a separate process. Although it might be possible (not sure) using private apis but your app will be rejected then.
You can find more info about this change here:
http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/
Hope this helps
Subclass UIToolbar
Create UINavigationController using
init(navigationBarClass:toolbarClass:) and supply UIToolbar subsclass created in step 1 for toolbarClass
Create QLPreviewController instance and push onto UINavigationController stack
Inside of UIToolbar subsclass override
setItems(_:animated:). To remove all buttons call super with empty array super.setItems([], animated: false) or potentially you can add only buttons you want to keep.
Present UINavigationController created in step 2
Here is the example PreviewControllerHideBottomButtons
Subclass QLPreviewController.
Search for the Toolbar in the view hierarchy.
Have a UIToolbar property in your class that has the same frame as the original toolbar.
Place your own toolbar above the default one with whatever buttons you want.
If you want it to be hidden as the default behavior of the QLPreviewController you can key value observe the hidden property of the default toolbar and present / hide your own accordingly.

How to make views visible and collapsed depending on whether the corresponding module is loaded or not?

I have a prism application already in production.
I need to create a new module in this application.The module can either exist on not exist in the application depending on the configuration file.
This module view should be dispalyed in a region already existing. The view should only be visible when the module is loaded.
Problem: the existing screen has a region showing 2 tab items from 2 different modules. Now the new view should be part of the first tab and it gives the user the option to select whether to view the previous info or the new info from this new module.
I am stuck and dont know how I am going to show these checkboxes when the new module is loaded and hide it when it is not. Where do I put this logic?
Current scenario:
Very vague images to define what i meant?
Here's an option that will work, and isn't too much effort...
Inside your beautifully illustrated Tab1, add another tab control, and make this a Prism region. Fill this region with both the original view, and the view from your new module.
Then, restyle the inner tab control, if necessary, so the tab headers appear like radio buttons, and set up a datatrigger to hide the tab header strip if the number if tabs is less than or equal to 1.
Thanks for all your help :)
After a lot of RND i figure it out.
I have created a two tabcontrol regions one for the main tab and the other for the child tab.
on the child tab i have return style to display tabitem only if item.count is more then 1 as suggested by mark.
and i have put this code in my existing module.

In my Windows Phone app,I want to turn my current page unable in gray and show a textbox in foreground

Like the title said,how may i turn the grid(or page) and the components in it into background gray and unable and show a new component in foreground.
It's a common effect in the web page,but i cannot do that with a xaml.
Please answer in detail better with sample code if you do.Thanks in advance.
Here's an example of using a Popup to display a UserControl when a Page is navigated to. The OnNavigatedTo function creates a popup, binds a Click event to the UserControl, and then shows the UserControl over the entire page. If the correct password is entered, ("password" in the example) the control disappears. You'll need to modify it for your own requirements, but it should definitely get you started.
https://skydrive.live.com/redir.aspx?cid=ef08824b672fb5d8&resid=EF08824B672FB5D8!343
You'll want to use the VisualStateManager and create some animation transitions to switch between the old and new components. I won't paste the code here for brevity, but if you check out:
http://visualstudiomagazine.com/articles/2011/07/22/wcmob_visual-states.aspx
You'll see a simple example of switching between two UI components on a single page within a Windows Phone 7 PhoneApplicationPage. In your scenario, you'd use this paradigm to create 2 animation storyboards, one for showing an overlay control and one for settings the 'disabled' property on the main grid.

ExtJS: Disable accordion animation

I've created accordion like this:
layout:'accordion',
layoutConfig:{
animate:true
}
then i add elements by add() method, then re-render it with doLayout() and set the activeItem:
navigation_panel.getComponent(1).expand(false);
i call expand() method with false parameter, but it still animates the transition, so it takes setting from main layout and ignore that i sent to expand(). How to solve this problem?
Two things happen when you expand an item in an according panel:
1. The old active item is collapsed
2. The new active item is expanded
The collapsing of the old active item is handled by the accordion layout and occurs during the "beforeexpand" event. Looking at the source code, I see that the accordion layout calls
var ai = this.activeItem;
ai.collapse(this.animate)
So, the animation of the collapse of the old active item is completely determined by the "animate" property of the accordion layout. The animation flag you pass in is ignored for these purposes. I'm guessing that if you look closely, you'll see your collapse is animated while the expand is not.
Because the animate flag is passed through explicitly, I don't see any standard, supported way to override this behavior for a single operation.
In 3.0+, you may call the documented method getLayout() before or after render to get a reference a Container's layout object. You could simply set the layout object's animate property to false while manipulating the panel, then set it back when your done. This is not documented to work but probably will based on the source.

Resources