Questions tagged [uiviewcontroller]
The UIViewController class manages the views in iOS apps and mediates the interaction between an app's views, its underlying model objects, and the overall workflow.
16,296
questions
0
votes
0
answers
29
views
Using Delegates - Have Customer and Employee Controllers Appear when Uploading to Firestore
What I'm trying to do is when customers submit a job request, which is the RequestJobConfirmationController, I want to be able to pull up the FindEmployeeJobRequestController on the customer side and ...
0
votes
0
answers
38
views
Why am I getting "Fatal error: Unexpectedly found nil while implicitly unwrapping an optional value?" [duplicate]
I'm trying to enable the highlighted property of UILabels when the corresponding image from a randomly generated array is shown. The UILabels are located on a second ViewController.
My code works when ...
0
votes
1
answer
39
views
SwiftUI interface orientation specific layouts
I have started experimenting with SwiftUI in order to port my app from UIKit to SwiftUI. Below is the code that is one of the building blocks. Basically, I want to place a 16:9 red subview in the ...
0
votes
0
answers
31
views
Correctly fetch ViewController interfaceOrientation
I am using the following code to retrieve interface orientation of custom UIViewController (which is not a navigation/tabview controller).
public var windowOrientation: UIInterfaceOrientation {
...
0
votes
1
answer
30
views
Set a UIViewController behind another one as a background image
I do not know if is it even posible. I was wondering if I could place a second UIImageView behind another one sort of like a "background reference image". I am doing it programmatically say ...
0
votes
0
answers
39
views
Init / Load / appear controller before pushing into UINavigationController [duplicate]
I'm redoing some things in a legacy app. One of the key things - before it used self-made push view controller animations, so view controllers that were "pushed" (not in a UINavigation sense,...
1
vote
1
answer
86
views
In SwiftUI showing an AdMob Interstitial breaks NavigationLink objects - what am I doing wrong?
I have a simple app with a Home View, a Content View and a Settings View. I am trying to show an AdMob Interstitial when I navigate from the Home View to the Content View. The navigation between views ...
0
votes
1
answer
65
views
Setting UIViewController preferredContentSize not working in iOS 17
In iOS 17, I am having an issue where UIPopoverPresentationControllers are not retaining the preferred size of the UIViewController they contain.
The following method uses a ...
0
votes
0
answers
38
views
How do I link a second view controller to a random image generator in Swift?
I'm having trouble working out how to stop my random image generator crashing when it reaches the last index in the array. I'm trying to get it to load a second view controller that I have created ...
-1
votes
1
answer
36
views
How to display a TableView and another view through one ViewController?
I'm learning how to develop in Swift currently. I'd like to be able to replicate the functionality displayed in the Apple Music UI screenshot below.
At a high level, I'd like a table view to select ...
0
votes
1
answer
34
views
Why is my root view controller getting pushed along with intended view when using navigationController.pushViewController()?
I have a UIViewController that is inside a navigation controller. When I push another view controller to the navigation stack it is pushed on top of a copy of the root view controller. The copy can be ...
0
votes
2
answers
32
views
When pushing a new view controller to my navigation controller, I get returned the the same view controller I tapped from instead of the new one
I have a UIViewController that has a UITableView added as a subview. When I tap on a cell to return a new UIViewController (detail view controller, empty aside from background color) I get returned ...
0
votes
1
answer
41
views
Cast in Swift does not work for a generic UIViewController subclass
I have a ToastViewController subclass of UIViewController with a generic ToastContentView being itself a subclass of UIView.
class ToastViewController<ContentViewType: ToastContentView>: ...
0
votes
1
answer
37
views
Passing a variable into custom UITableViewHeaderFooterView
There's a UIViewController containing UITableView.
class ProfileViewController: UIViewController {
private lazy var profileView: ProfileHeaderView = {
let profileView = ProfileHeaderView()...
0
votes
0
answers
30
views
How to get notified when controller presents and dismisses popup
I have a vc: MyUIViewController. Under some conditions it may present a modal popup. I do not have direct control on when and why it happens.
At any moment I can find out if it presents anything ...
0
votes
1
answer
50
views
Communication between DidReceiveNotificationResponse in AppDelegate.cs to ViewController on click of a notification
I am creating notifications like this when the user enters a geo fence.
UNMutableNotificationContent notificationContent = new UNMutableNotificationContent();
notificationContent.Title = "Entered ...
-1
votes
2
answers
50
views
How to go back to ViewContoller?
I am making app for iOS and using Swift. When I open WebViewController from ViewController it works fine but the problem occurred when I click on the back button in the navigation bar to go back to ...
0
votes
1
answer
52
views
Change Notification Content Extension Interface Size Xamarin iOS
I've implemented a notification content extension in order to get action buttons to show up properly in my app. All I need for my notifications is the default header and the action buttons, no ...
1
vote
1
answer
30
views
Clear/Remove multiple ViewController in NavigationController
I hope you can help me with this issue.
I am developing this iOS application with multiple ViewControllers, as shown in the following image.
I navigate from VC1 to VC2, VC2 to VC3 until I reach VCn. ...
0
votes
0
answers
57
views
UIViewController addChild and translatesAutoresizingMaskIntoConstraints
I see some weird behavior concerning translatesAutoresizingMaskIntoConstraints when using addChild.
I created a UITableViewController programmatically, put it inside a UINavigationController, also ...
0
votes
1
answer
81
views
How do I set up my UIViewController to avoid drawing in the notch and bottom slidebar areas?
I'm resurrurecting an app that I wrote in 2015, and it still works full-screen, but I'm busting my head trying to figure out how to avoid drawing in the notch area and bottom slidebar area on iPhone X ...
-1
votes
1
answer
57
views
How to integrate NumberFormatter for a simple calculator app?
I am trying to update an existing code to have grouping separators with commas (i.e. 10,000,000 instead of 10000000) How can I achieve this with a simple way? I am posting the existing code.
All I ...
0
votes
2
answers
44
views
Uikit: blur and dim behind a UIViewController (like a popover)
I am showing a complicated controller AskController (descended from UIViewController, UIPopoverPresentationControllerDelegate and UIPopoverControllerDelegate) over some different controllers, popover ...
0
votes
0
answers
80
views
UIPageViewController doesn't prepare initially neighbouring view controllers in Swift
I'm developing an iOS app using SwiftUI with UIKit's UIPageViewController with UIViewControllerRepresentable and I'm not good with UIKit. I have array of three view controllers which are ...
-1
votes
1
answer
131
views
How can I detect when the system changes dark/light mode in Swift?
I know there are plenty of answers pointing to traitCollectionDidChange, but that is going to be called when the userInterfaceStyle of a view controller changes, and I would like to let the user ...
0
votes
1
answer
68
views
Using modal view frame size in subview layout constraints
Problem: I am having some issues using the correct frame values to simulate viewport percentages when sizing subviews of a modal view-controller. I would rather size subviews using layout constraints ...
0
votes
0
answers
48
views
I am Using LazyHGrid / LazyHStack inside Custom ScrollView(UIScrollView), but lazy nature is not working
Can anybody tell me how can i set offset in a ScrollView?I have checked ScrollTo(), which scroll to index wise. But I want to move scrollview with offset. I have also checked Custom ScrollView( from ...
0
votes
0
answers
24
views
How would I access subviews in CNContactViewController?
How would I access the subviews in CNContactViewController. I know they are properties of the UIView instance in CNContactViewController, since CNContactViewController inherits from UIViewController.
...
-1
votes
2
answers
41
views
Navigation controller bar is low for no reason
I created a Tab Bar Controller, with 4 navigation controllers each containing one view controller, but on these view controllers, the bar titles are super low. It doesn't matter if I choose large ...
0
votes
0
answers
56
views
PreferredStatusBarStyle not called on iOS 15
I have a very interesting situation up in my hands. As you know when you override preferredStatusBarStyle of a UIViewController and have set the needed flag in Info.plist to true we should have per ...
0
votes
1
answer
17
views
How to automatiaclly load view from parent XIB file in UIViewController subclass?
Assume SomeViewController being a subclass of BaseViewController.
Calling BaseViewController() automatically loads the view from BaseViewController.xib.
Calling SomeViewController() will automatically ...
0
votes
1
answer
38
views
How to create a referencing outlet for a Tab Bar Controller
I had created a tab bar in my storyboard, that I linked to a swift file to add some properties, and everything was working fine. But then I decided to change for a navigation controller, and now I can'...
0
votes
0
answers
44
views
Hiding a popup in a webview
I am new to iOS programming (Xamarin). I want to show a view when a link in a popup in a webview is clicked. (image attached)Popup picture
if(msg == "Settings")
{
...
0
votes
0
answers
96
views
How can I avoid the titleEdgeInsets' was deprecated warning / Swift
I'm trying to make the warning 'titleEdgeInsets' was deprecated in iOS 15.0: This property is ignored when using UIButtonConfiguration disappear.
At first, I used
InfosButton.titleEdgeInsets.top = ...
0
votes
1
answer
177
views
How to avoid viewSafeAreaInsetsDidChange() being called in UIViewController
I have a child-view controller that do not want to have system safe areas or viewSafeAreaInsetsDidChange() called on rotation. So far this is not working:
In Superview:
let childVC = UIViewController()...
0
votes
0
answers
33
views
Xamarin iOS, Error while presenting a view from the main view controller
From the first viewController I am trying to show a second screen.
MobileSettingsViewController mobileView = new MobileSettingsViewController(Handle);
PresentViewController(mobileView, false, null);
I ...
0
votes
1
answer
15
views
Custom present transition for 2 nested view controllers with 2 simultaneous animations?
I have 2 nested view controllers with different animations. First one has alpha animation and second one moves from bottom to top with constraint.
My current implementation is just show/hide methods ...
0
votes
0
answers
46
views
SwiftUI, UIViewController banner wrapper consumes too much space
Integrating AdMob into a SwiftUI app, the Google sample code utilizes a UIViewController to display banner ad. The banner view, stretches to the maximum possible height, causing display issues. the ...
0
votes
1
answer
58
views
Segue and attempt to present whose view is not in the window hierarchy
In iOS 16.4 I have 3 view controllers. The first one has a button that will show "show eg. push" VC1 nothing more. In VC1, using UILongPressGestureRecognizer to show VC2 over segue.
import ...
0
votes
1
answer
26
views
ViewController showing extra left item out of nowhere if I do a segue from another VC
I currently have a setup of 2 view controllers with the 1st one embedded in a navigation controller. I set up a segue from the 1st to the 2nd which works. However, after trying to set up another segue ...
-1
votes
1
answer
213
views
Xcode 13.4.1: viewIsAppearing: Method does not override any method from its superclass
final class Foo: long chain of derivation leading to UIViewController {
override func viewIsAppearing(_ animated: Bool) {
// ...
super.viewIsAppearing(animated)
}
}
Xcode 13.4....
1
vote
3
answers
103
views
UILabel.text is overlapping on change
I have a simple UIViewController with UILabel and UIButton:
class MyScreen: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .blue
...
0
votes
1
answer
76
views
iOS - Control Input to UITextField from SwiftUI Buttons
I have a custom keypad that works with a custom text field. It looks great on the iPhone but not so great on the iPad. I want to control the text field with the buttons of the keypad but not have the ...
1
vote
0
answers
38
views
Set `titleView` of `UINavigationItem` to view of a child `UIViewController` without adding to navigation stack
I have a UIViewController, and I want to use its view as the titleView for a UINavigationiten. If the View Controller is a child of the top view controller, the app crashes when I set the titleView, ...
0
votes
1
answer
25
views
UITabBarController issue - something (UINavigationBarContentView?) overlays the button on child UIViewController so the button can't be pressed
I implemented UITabBarController with a tab made of UIViewController. It consists of two parts - UIView with UIButton placed into, and a UITableView. I didn't used UITableViewController because it's ...
-1
votes
2
answers
56
views
Why is it incorrect to call viewDidAppear() in ViewController (Swift)?
I'm currently trying to develop a gps trail recording app, and I've run into some issues while trying to reload the ViewController. Essentially, while recording a path, an MKOverlayRenderer draws the ...
1
vote
1
answer
28
views
Open MapViewController and center on Lat/Long when user taps notification banner
So I'm having a tough time. I'm new to Swift but have been getting better. I have an app where users will receive a notification when something is placed on the map. What I'm trying to do is launch ...
1
vote
1
answer
77
views
SwiftUI can't find SFSafariViewController in scope error
I'm trying to implement social auth for google with SwiftUI in Supabase:
https://github.com/supabase-community/supabase-swift#google-sign-in
The problem is with this part of the code in the tutorial:
...
1
vote
0
answers
30
views
Big gap between navigation bar and image view
I want to have an image attached to the navigation bar in the top, and I've set the constraint for aligning the top to the Safe Area. However, I'm still getting a gap between the navigation bar and ...
1
vote
1
answer
30
views
Saving updated UILabel on ViewController until app is closed
I have a UIView where I can change a status in UILabel with UITextField, but after I shift to another ViewController my UILabel has an old default text.
I'm only a student so I don't need to save info ...