Keep Tab Bar when selecting Side Menu item - uitabbar

I really need some help. My Tab bar is disappearing whenever i select one of the items from my Side Menu.
I've created a Side Menu (with pods) but when I select one of the menu's items, the Tab bar disappears. My Tab bar is supposed to stay visible all the time with only 4 or 5 main view controllers. On my Side menu I want to access secondary View Controllers that are not visible on the Tab Bar, but I want to keep the Tab bar visible all the time with the main View Controllers which are the most important ones and I can access it easily.
I've tried several codes but nothing works. I could use some help with this. I think the problem is the instantiation or the presentation of the Secondary VC (Configurations).
Thanks in advance
On a separate file I've created a Class Constants where I'll setup my list of items for the menu:
struct Constants {
//Storyboards
struct Storyboard {
static let Configurations = "Configurations"
}
//Menu list
enum sideMenuItems: String, CaseIterable {
case config = "Configurations"
}
}
Then on the Main view controller, I've setup a button that slides the Menu from the left and i've coded the Menu's button tapping like this:
private var sideMenu: SideMenuNavigationController?
func didSelectMenuItem(named: Constants.sideMenuItems) {
sideMenu?.dismiss(animated: true, completion: { [weak self] in
switch named {
case .config:
let Configurations = self?.storyboard?.instantiateViewController(withIdentifier: Constants.Storyboard.Configurations) as? Configurations
self?.view.window?.rootViewController = Configurations
self?.view.window?.makeKeyAndVisible()
}
})
}
What is wrong with the code? I can I get the tab bar to stay visible?

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.

Show context menu in Autodesk.Viewing.Viewer3D

I am trying to show a context menu using Autodesk.Viewing.Viewer3D (Headless Viewer).
I can get the context menu to show up easily when using Autodesk.Viewing.Private.GuiViewer3D as my viewer type but i don't want to use this viewer type as it has a toolbar and i don't want it to appear for this viewer. I can't use the css approach suggested here as I also want the toolbar in a different viewer in the same application.
My attempt to initialise a context menu using Autodesk.Viewing.Viewer3D (Headless Viewer) look like the following:
var contextMenu = new Autodesk.Viewing.UI.ObjectContextMenu(viewer);
viewer.setContextMenu(contextMenu);
viewer.registerContextMenuCallback('CustomContextMenuItems', function (menu, status) {
if (status.hasSelected) {
if(menu === null){menu=[];}
while (menu.length > 0) {
menu.pop();
}
menu.push({
title: 'Do Something',
target: function () {
console.log("Doing something")
}
});
}
});
The context menu is intended to be used with GuiViewer3D. It's most likely relying on some of its HTML or CSS setup, which is why it's causing issues with Viewer3D. If you need this level of customization of the GUI, I'd suggest to implement a separate, simple context menu instead of bending the built-in one.

Swift iOS -Programmatic RootViewController is Light Gray?

I'm just getting in to programmatic vc's with no more storyboards and I'm following YouTube's LetsBuildThatApp by Brian Voong for guidance https://youtu.be/NJxb7EKXF3U?list=PL0dzCUj1L5JHDWIO3x4wePhD8G4d1Fa6N.
I followed all the directions and for some reason when I launch my app I get this light gray haze over my screen and I can't figure out why? I can faintly see the navigation title and blue background but it's covered by a faded layer.
Step 1:
I deleted my storyboard file and sunder the General Tab under Deployment Info I deleted "Main" from Main Interface.
Step 2:
I changed my ProjectNavigator file to FeedController then Changed the file accordingly
import UIKit
class FeedController: UICollectionViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Facebook Feed"
collectionView?.backgroundColor = UIColor.white
}
}
Step 3:
In AppDelegate I added a NavVC and made FeedVC it's root and made the NavVC the Window's root. I also change the NavBar and StatusBar color
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
let feedController = FeedController(collectionViewLayout: UICollectionViewFlowLayout())
let navVC = UINavigationController(rootViewController: feedController)
window?.rootViewController = navVC
UINavigationBar.appearance().tintColor = UIColor.blue
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white]
application.statusBarStyle = .lightContent
return true
}
Step 4:
In info.plist I set View controller-based status bar appearance to NO
I can't figure out why I get this light gray haze over my screen
What am I missing here?
It looks like you are configuring the tintColor instead of the barTintColor. The tintColor changes the color for the navigation buttons and the barTintColor adjusts the navigation bar background color. You can watch this video for more details on customizing navigation bar appearance.
https://www.youtube.com/watch?v=RO8_mqRJO-4

Map json to menu in Openui5

In w2ui I can map a json to a sidebar http://w2ui.com/web/demos/#!sidebar/sidebar-1
Can I do it in openui5?
I want the same result.
Obviously I do not want a tree but a list of items that swipe right if I tap on an item (and visualize a sub-menu list) and slide left if I press back button (and visualize the menu at upper level).
I think it's possible, but as far as I know you have to do some manual labor:
Detect whether your node has one or more child nodes, and based on that set the sap.m.ListType to Navigation or not
If your root node (f.i., "/items") has child nodes (f.i., "childs"), you need to re-bind your list to this child path ("/items/<index_of_parent_node>/childs)
To get the swiping effect, you probably need to encapsulate the list in a sap.m.Page
Depending on the node level you're in, you need to hide/display your back button, and by pressing it bind your list to the parent path
However, if there's a cleaner, simpler approach I would love to hear it too!
I solved my problem:
Every time that i click on a menu item i call this function into view controller:
//when click on item
onPressMenuItem: function(evt) {
var selectedItem=evt.getSource().getBindingContext().getObject();
var objAction=getActionWhenPressMenuItem(selectedItem, this.getView().getModel());
console.log(objAction);
if(objAction.hasNextSidebar==true){ // sub menu
var model = new sap.ui.model.json.JSONModel();
model.setData(objAction.nextSidebar);
var oSplitApp=sap.ui.core.Core().byId("splitApp");
var nextView = sap.ui.xmlview("general.master.menuMaster");
nextView.setModel(model);
nextView.byId("idPageSidebar").setTitle(selectedItem.text);
oSplitApp.addMasterPage(nextView);
oSplitApp.toMaster(nextView);
}else{ // open operation detail
var idDetail =objAction.opDetail;
var targetApp = getAppBySelectionId(idDetail);
if(targetApp.masterView!=null){//if app has own master
sap.ui.getCore().getEventBus().publish("navMaster", "to", {
idView: targetApp.masterView
});
}
if(targetApp.detailView!=null){//if app has own detail
sap.ui.getCore().getEventBus().publish("navDetail", "to", {
//titleOfDetailPage: selectedItem.text,
idView: targetApp.detailView,
//idCall: selectedItem
});
}
}
},
I create every time a new istance of the menu on a new page.

UISplitView with toolbar/tabbar at bottom of detail view

So here goes. I started with a standard out of the box splitview application for iPad. Root view left and detail view to the right. Detail view has it's toolbar at the top.
What I would like to add is a tab bar to the bottom of the detail view and have the tabs load in the details view, between the toolbar tabbar.
Here is the problem, do I add another view between them to load the tabs into, if so how do I get it resize and respect the toolbar and tabbar heights.
Clear?
Hope someone can point me in the right direction. Examples would be great, every example on the web seems to just be out of the box hello world style.
Yes the answer is really very simple. UITabBarControllers like SplitViewControllers were intended by Apple to only ever be the Root View Controller and hence you cannot nest a TabBarController in another view, but you can nest a UITabBar in a view, however.
I added the Tabbar to the details view at the bottom, a Navigation bar at the top and then a placeholder view between them. All in Interface Builder!, You will want to switch everything on with the autosize on the Placeholder view.
Next, Implement the UITabBarDelegate. For this you will need:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
from that you can use item.tag which if you give each item a unique tag in Interface Builder will let you know which tab the user clicked. I setup defined values for mine:
#define VIEW_TAB_A 0
#define VIEW_TAB_B 1
#define VIEW_TAB_C 2
Then you will then want to... well best I just let you see
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
[self switchToView:item];
}
- (void) switchToView : (UITabBarItem*) item {
if( currentViewController != nil ) {
[currentViewController viewWillDisappear:NO];
[currentViewController.view removeFromSuperview];
}
switch(item.tag) {
case VIEW_TAB_A:
currentViewController = self.viewA;
break;
case SCAN_VIEW_TAB_B:
currentViewController = self.viewB;
break;
case PROMOTIONS_VIEW_TAB_C:
currentViewController = self.viewC;
break;
}
UIView *aView = currentViewController.view;
aView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
aView.frame = placeholderView.frame;
[currentViewController viewWillAppear:NO];
[self.view insertSubview:aView aboveSubview:placeholderView];
if( currentViewController != nil ) {
[currentViewController viewDidDisappear:NO];
}
[currentViewController viewDidAppear:NO];
}
Remember to alloc the views (viewA, viewB, viewC) first in you viewDidLoad and obviously release in dealloc. Also take note of the autoresizingMask!
Hope this helps others.