Prevent view controller from stacking IOS 13 (swift) [duplicate] - ios

This question already has answers here:
Presenting modal in iOS 13 fullscreen
(27 answers)
Closed 3 years ago.
I am working on an app and recently updated to my Xcode. With this update the way view controllers are presented is changed and I want to revert it back to its old ways. They used to display over the other ones but now they "stack".
I would like the iPhone on the left, while what I currently have is the iPhone on the right.
Thanks.

You just need to change presented view controller modalPresentationStyle to full screen.
let myModalController = MyModalController()
myModalController.modalPresentationStyle = .overFullScreen
self.present(myModalController, animated: true, completion: nil)

Related

Disable Long Press back Button (callout menu) [duplicate]

This question already has answers here:
Is it possible to disable the back navigation menu in iOS 14+?
(5 answers)
Closed 2 years ago.
iOS14 introduced that long-press on back button which opens a callout menu to go back to specific VC in stack.
I would like to disable it, is there a possibility to do such a thing, and if yes how ?
Thanks
Try to set backButtonDisplayMode to .minimal on your VC ->
if #available(iOS 14.0, *) {
navigationItem.backButtonDisplayMode = .minimal
}
https://developer.apple.com/documentation/uikit/uinavigationitem/3656350-backbuttondisplaymode

iOS Google Sign In not displaying above modally-presented view controller [duplicate]

This question already has answers here:
Google Sign In Button does Nothing
(6 answers)
Closed 2 years ago.
I've been following the directions to get Google Sign On working on my iPhone app. I'm using XCode 11.5. My iOS target is iOS 12.1.
When you click the google Sign In button you've placed on a view controller, a little alert window is supposed to pop up and ask if you want to proceed to sign in with Google.
The problem is that this doesn't happen with my Google Sign In button on a view controller that I've presented modally. Instead, nothing happens when I click the button. I can't see any alert asking me do I want to Sign In with Google. My modal presentation code looks like this:
print("Not logged in found.")
if(loginVC == nil) {
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
loginVC = storyBoard.instantiateViewController(withIdentifier: "LoginVC") as! LoginViewController
loginVC!.sessionTracker = sessionTracker! // some coredata stuff I use
loginVC!.loginReceptionDelegate = logsVC! // view controller underneath this one
loginVC!.modalPresentationStyle = UIModalPresentationStyle.fullScreen
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.navC!.present(self.loginVC!, animated: true, completion: nil)
}
If I put a Google Sign In button on the view controller underneath the modally-presented one, then I see the alert when I click the Sign In button.
Why doesn't it work with the modally-presented view controller?
I've verified that I can see alerts created with UIAlertController above my modally-presented view controller, so I don't think the Google pod code is even attempting to proceed with the sign in flow for the user (my top view isn't obstructing the alert I created on my own).
This used to work. I had this exact same project working with version 4.x of Google's sign in framework about a year ago, but I bought a new mac laptop and when I cloned my project to the new computer, I encountered this issue. I've upgraded to version 5.x of their sign in pod but this hasn't solved the problem.
Flagged my question as a duplicate because I finally found the answer elsewhere here on stack overflow.
Anyway, the problem was that my modally-presented view had a tap gesture recognizer that was interfering with clicks on the Google button.
tapGesture.cancelsTouchesInView = false
Fixed it.

When I updated the Xcode, in my app, my root view controller can be seen at the top of the current view [duplicate]

This question already has answers here:
Presenting modal in iOS 13 fullscreen
(27 answers)
Closed 3 years ago.
So when I drag it down the app will dismiss the current view an go to there. I don't want it, how should I fix it? Everything was okay till update
In iOS 13, the default modal presentation is sheet, which is what you got.
To get the old modal style, do:
loginVC.modalPresentationStyle = .currentContext
In the iOS 13 SDK the color handling changed crucially due to the introduction of Dark Mode.
Set the background color of the current view to System Background color.
And consider that all modally presented view controllers are presented as sheet by default.

iphone x home indicator issue while using tableViewController [duplicate]

This question already has answers here:
TableView and the home indicator on iPhone X
(3 answers)
Closed 5 years ago.
I have some doubts. I'm using a UITableViewController, and at bottom it's not giving space for the home indicator. It goes behind the home indicator (refer to the image). If I add any button actions to the last cell, this will surely cause an error.
Refer this to add programmatically... https://developer.apple.com/documentation/uikit/uiview/positioning_content_relative_to_the_safe_area
Use Safe area layout constraints. See the attachment bellow.Your problem will be solved.

iOS 5 UIAlertView customisation [duplicate]

This question already has answers here:
Alert view is showing white rectangle in iOS7
(3 answers)
Closed 9 years ago.
I am adding UIButton to UIAlertView as below
it is fine with iOS 6 and below now in iOS 7 it comes like this
Please let us know the way to resolve this issue.
You can't add any view as a sub view in alert view as per the IOS 7 standard. please refer apple document. (UIAlert view customization not possible in IOS 7)
Please refer:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/UIKitUICatalog/UIAlertView.html#//apple_ref/doc/uid/TP40012857-UIAlertView-SW1
You can find the answer on this link
But this is wrong approach , you can see this on same link
Alertview should only use to show below details
Be immediately informed of critical information
Make a decision about a course of action
For above task you should use pickerview or tableview depends on the requirement.

Resources