I am trying to create the same experience where a sheet is presented in one of the tab items of a TabView - not covering the tabs.
I am using .presentationDetents() and SwiftUI4.0 for that.
See example of Apple's own app doing that
The sheet is covering the child view inside TabView.
However, instead in my own code I am getting
this - the tabs of the parent view are covered by the modal sheet
The link https://developer.apple.com/forums/thread/711702 suggests that it is not possible to achieve the same behaviour you see in Apple's Maps and Find My apps with the current SwiftUI API.
Related
I was looking to replicate the functionality contained in the native iOS Clock and Contacts apps for list items. After pressing "Edit" at the top right, red "minus" circles appear on the left side of each list item. If you press the minus sign, it "swipes" the list item to the right and shows the "Delete" swipeAction:
Contacts Groups List View
Contacts Groups List Edit View
Contacts Groups List Edit View - Swipe Action Active
I can set the swipeActions for a list item easily, and can replicate the edit button. As well as adding the minus buttons when editing the list (I used an HStack with a Button and Text view inside). What I cannot find anywhere is how to have the button action show the swipe action. All related posts comment on having the button action closure run the code that a gesture would typically activate. From what I understand, the gesture handling is done inside of SwiftUI itself for swipeActions, and I cannot find a way that you could imitate the result. Would this be something that would have to be done in UIKit? Or would I have to build a custom version of swipeActions to implement the same feature?
I have tried researching imitating gestures on Views, but everything seems to say it is not possible to do so
SwiftUI can easily present a sheet view on top of the existing review when a condition is met (see screen record below). What is the sheet component equivalent in UIKit?
Tried to Google a result and it looks like there is a sheet related view called UIActionSheet, but that does not seem like the right UI control.
REFERENCE
Example of how to achieve the same behavior with UIKit.
iOS 14 navigation bar title is not displayed in UINavigationController created programmatically
This is just another UIViewController presented modally with a Done UIBarButtonItem on the right side.
I am looking to implement a custom Tab Bar in iOS where selected item is bigger size than the rest of the tabs and peeks out over the content similar to this screenshot.
Could someone point to a tutorial of how to accomplish this preferably in Swift?
I faced with this task several times. I found a lot of tutorials but I've never found one that gives the ability to create a center button that part of it is out of the tab bar.
At the end, I created an approach to have it done correctly. I implemented a simple example project with instructions how to do that. Please check my Custom Tabbar Center Button repo as an example.
One more benefit of it it's center button hides correctly with the tab bar when you use Hide Button Bar on Push property.
A UITabBar contains an array of UITabBarItems, which inherit from
UIBarItem. But unlike UIBarButtonItem that also inherits from
UIBarItem, there is no API to create a UITabBarItem with a customView.
So instead of trying to create a custom UITabBarItem, we’ll just
create a regular one and then put the custom UIButton on top of the
UITabBar
Not swift, but should be easily translated.
https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar
This one is Swift:
https://github.com/itsKaynine/SwiftRaisedTab
Source code for a similar question, using Swift 3:
https://stackoverflow.com/a/36016377/300897
I’m experiencing unusual behavior on an iPad in iOS 6.1.2 when using a UITabBarController with a UISplitViewController (which has a UITableViewController for the master view controller). If I have multiple tabs, of which at least one tab contains a split view controller, and I am in landscape mode while viewing the tab that contains the split view controller, then I switch to another tab, then move to portrait mode, then press the tab that contains the split view controller, what happens next is that the master view controller (a table view controller) will display the table view over top of the detail view, when it is clearly not supposed to be there. This behavior happens only the first time the app is loaded, but is consistent behavior.
This scenario is easy to recreate by simply creating a project that is a split view application that uses an iPad device and Core Data (didn’t try it without using Core Data). After the project is created, use the storyboard and add a tab bar controller and make it the initial view controller, then add a view controller seque from the tab bar controller to the split view controller. After that, only one change is necessary in code which is to change the one line in application:didfinishLaunchingWithOptions in the AppDelegate.m:
Change the following template code:
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
To:
UITabBarController *tbc = (UITabBarController *)self.window.rootViewController;
UISplitViewController *splitViewController = [tbc.viewControllers lastObject];
Perhaps I’m breaking some iOS rules, and trying to do something I’m not supposed to? All I want to do is to be able to tab between a few different split view controllers. Suggestions?
Take a look at this Git.
https://github.com/nalyd88/DCToolkit/tree/master/DCToolkit/DCToolkit
From what I understand the problem stems from the split view controller not updating it's orientation when it's not visible.
Here a subclassed tab view controller and split view controller are used which pass the message along.
Thanks to Dylan at http://objectiveseesharp.wordpress.com/ for this solution! I just found it.
I am trying to embed a Tabbar in the Detail side of a Split View Controller. The way I have done is that in the Storyboard I have the TabBarController as the DetailViewController and from there I have a couple of Navigation Controllers hooked to views ( separate tabs which are of type DetailViewController).
The problem I am facing is that out of two tabs which I have added, only one tab shows the button for showing the Master view in the Portrait mode.
I am new to iOS development, and would deeply appreciate any help towards solving this.
Thank you for your time.
From the documentation for the UITabBarController: "When deploying a tab bar interface, you must install this view as the root of your window. Unlike other view controllers, a tab bar interface should never be installed as a child of another view controller."
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UITabBarController_Class/Reference/Reference.html