2018-10-22         Laura

How to force iOS device to determine it's orientation via gyroscope?

I have a situation where my app sometimes forces particular view controllers to appear in a particular orientation.The only way I've found to do this is to set the device orientation manually, and tell the app to attempt to rotate itself like this:switch (forceOrientation){ case Orientations.PORTRAIT: let value = UIInterfaceOrientation.portrait.rawValue UIDevice.current.setValue(value, forKey: "orientation") UIViewController.attemptRotationToDeviceOrientation() case Orientations.LANDSCAPE: let value = UIInterfaceOrientation.landscapeLeft.ra...

 ios                     1 answers                     84 view
 2018-10-22         Jacob

How to fix SIGABRT erorr? Transferring data between controller views?

I'm trying to get the information in the text fields in one view controller and then put that information into the text view of another view controller. When I compile I get no error but when I run the program and click the find path button the program crash and gives me a sigabrt error. Note: I didn't add any code to the viewcontroller(1st screen), therefore I didn't add a picture of it. And this is in Swift 4, Xcode 9 To fix this problem I looked at the connection of each of my view controllers. Than I deleted the ones with an "!" next to the connection by clicking the...

 ios                     1 answers                     87 view
 2018-10-22         Louise

UiViewController takes a long time to display

then I have a UIViewController class that is called instantiated and displayed by a method, the problem lies in the fact that the end of self.present the view is not completely displayed, but only a part is displayed, after about 5-6 seconds, the rest of the view is also displayed! How can I make the view appear completely at the end of self.present?Swift Code: ///First Method (It's call nextviewcontroller var ret: Bool = false let c = c(c: self.c!) c.crea(n: self.txtn.text!, completion: { result in ret = result }) ...

 ios                     1 answers                     87 view
 2018-10-22         Anna

How can I show a new view controller after 3 seconds

I want to show a new ViewController after I clicked on a button, but not directly. After clicking the button I want to wait 3 seconds an after the 3 seconds I want the new ViewController Add delay on click of button:DispatchQueue.main.asyncAfter(deadline: .now() + 3) { // Your code with navigate to another controller} [XXX]You can use a scheduled timer to fire off a function after a given timeInterval.let timer = Timer.scheduledTimer(timeInterval: 3, target: self, selector: #selector(showVC), userInfo: nil, repeats: false)@objc func showVC() { //navigate to your ...

 ios                     4 answers                     88 view
 2018-10-22         Harlan

how to move the secondViewController from the top of the firstViewController using panGesture?

I'm trying to move the secondViewController off the firstViewController's top using panGesture but I'm running into a problem...when I start moving the secondViewController a black screen show up right behind the controller and not the firstViewController (as I expected) and I don't know how to fix this problem... here's the code that illustrate my problem...firstVC here..import UIKitclass mainController: UIViewController { let tapGestureRecognizer = UITapGestureRecognizer() let secondVC = SecondViewController() override func viewDidLoad() { super.viewDidLoa...

 ios                     1 answers                     94 view
 2018-10-22         Vic

Find out from where ViewController was opened

I have a TableViewController and 2 ways to get there. one is a segue(show) from a Viewcontroller that is the root controller of a Navigation Controller, which itself is a tab of my Tab Bar Controller.second, the tableVC is also a root VC of antoher Navigation Controller, that is also a tab in that Tab Bar Controller. Here is an illustration:Now i want to check in the viewDidLoad if my TableVC, whether it is called by the first or by the second way. How can i find that out? You could add a property to your view controller that indicates where it came from…class MyTableVie...

 ios                     2 answers                     92 view
 2018-10-22         Kama

sending ui data in swift

I'm a bit beginner in SWIFT and right now I'm facing a problem whit UI. In this PHOTO I'm showing my UI to clarify what I'm saying . in part 1 I check if the user is logged in to his account or not, if yes it goes to part 3, if not it goes to part 2. when user login in part 2, I transfer the user to part 3.part 1 and 2 should not have any navigation color, though the part 3 should have the navigation color.Part 1:if let token = UserDefaults.standard.string(forKey: ConstantsKey.token){ if !token.isEmpty{ let storyboard : UIStoryboard = UIStoryboard(name: "M...

 ios                     2 answers                     94 view
 2018-10-22         Derrick

Tapping on a tabBar item should always open the first view controller

I have an application with a tab bar navigation (5 buttons). Is it possible to always open the first controller of the navigation when tapping on one of the 5 tab bar buttons? For example, button1 opens VC1 (with navigation controller), which can open VC2, which can open VC3, etc. And if I am on VC3, then click on another tab bar button (let's say button2), then again click on button1, I want it to open VC1, not VC3 where I left it.I tried with this, but for some reason it's not working like I expect:func tabBarController(_ tabBarController: UITabBarController, didSelect vi...

 ios                     2 answers                     95 view
 2018-10-22         Zebulon

Create Default Back Button with Custom Button in LeftBarButtonItems ios

I am creating a project where I need to have a default back button and custom filter button on the left side of the navigation bar.I have created custom back button, custom filter button and add both of them to leftBarButtonItemsnavigationItem.leftBarButtonItems = alignedLeftBarButtonItems() func alignedLeftBarButtonItems() -> [UIBarButtonItem] { let filterButton = createLeftCustomBarButton() // back button creation let backButton = UIBarButtonItem(image: R.image.navBackArrow(), style: .plain, target: self, action: #selector(self.backB...

 ios                     1 answers                     96 view
 2018-10-22         Adela

How to differentiate various NavigationController?

I am using Multiple NavigationController in my app let navViewController = UINavigationController(rootViewController: vc)Assigning tag asnavViewController.navigationBar.tag = 10& fetching as if navigationController?.navigationBar.tag == 10 {Instead navigationBar.tag, Can't we differentiate using navViewController reference or navigationController.tag ? Using tags to differentiate between navigation controllers is ok. To make the code more readable and to avoid any possible mistakes you can define tags as constants or enums and check for the constant value.The othe...

 ios                     1 answers                     97 view
 2018-10-22         Gill

Customize the spacing and formatting of back icon and text in navigation bar

I have added a custom image for back button in the navigation bar. Here is the function for setting up my navigation bar.func setUpNavBar() { self.navigationController?.navigationBar.isHidden = false self.navigationController?.navigationBar.tintColor = UIColor.black self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "BackArrow") self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "BackArrow") self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "Back", style: UIBarButtonItemStyle.plain...

 ios                     1 answers                     96 view
 2018-10-22         Hilary

iOS black line on navigation controller transition

When the push/pop transition is performed on my view controller(which has large title and search bar embedded in navigation item), the black line appears briefly, like this:I've basically tried changing all the navigation bar colour related things, but nothing helped.Any help would be appreciated :) extension UINavigationBar { var customStyle: NavigationBarCustomStyle { set(style) { switch style { case .clear: self.setBackgroundImage(UIImage(), for: .default) self.shadowImage = UIImage() self.tintColor ...

 ios                     2 answers                     99 view
 2018-10-22         Tom

SCLAlertView Button

When I used third party SCLAlertView there was a problem actually there is a problem that is I want to perform some action when the button will pressed but there is just the customization properties but I am wondering for the action scope can someone help me out? you can use this let appearance = SCLAlertView.SCLAppearance( showCloseButton: false // if you dont want the close button use false ) let alertView = SCLAlertView(appearance: appearance) alertView.addButton("Ok Pressed") { print("Ok button tapped") }alertView.showSuccess("Success", su...

 ios                     2 answers                     91 view
 2018-10-22         Violet

How can I add a button on top of a UIPageViewController?

I have a page view controller with 3 pages. I want a 'floating' button to be visible on top of all of them. I have tried using a container view for the PageView but that doesn't seem to work. How else can I get the button to remain visible across all 3 pages?I have tried using a container view as stated in this question:UIButton across all pages of UIPageViewController Alternatively to my other answer, you can add a button programmatically.Declare:let button = UIButton()and if you want, create a function called setupView()private func setupView() {//Here we set up the si...

 ios                     2 answers                     94 view
 2018-10-22         Phyllis

How to change Color of cell in UiCollectionView if just two can be selected

I am used button inside UICollectionView cell, and I want to button can change color just two indexes and other can't change color if click other buttons uicolor.clearand I want to like this, so how to use sender.backgroundColorfunc collectionView(_: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellB", for: indexPath) as! BandingCollectionViewCell cell.bBandingCell.addTarget(self, action: #selector(masterAction3(_:)), for: .touchUpInside) retur...

 ios                     2 answers                     100 view
 2018-10-22         Kyle

Accessibility issue on IOS. aria-expanded not detected by voiceover

I am encountering accessibility issue on iOS using voiceover. "aria-expanded" not reading expanded when bootstrap button drop-down is expanded.Reference link:https://getbootstrap.com/docs/4.0/components/dropdowns/Using the same button drop-down for my websitePlease, can anyone come up with the solution.Specifically with IOS*Thanks in Advance ;) That's how voiceover handles dropdown menus. The example on the bootstrap site is correctly toggling the aria-expanded attribute. The change of state is announced with NVDA and JAWS but VoiceOver chose not to announce it. Ho...

 ios                     1 answers                     8 view

Page 2 of 4132  |  Show More Pages:  Top Prev Next Last