Questions tagged [uiviewcontroller]

1

votes
1

answer
2.6k

Views

Add subview to tableview which doesn't scroll

I'm using a UITableViewController and want to add a searchbar. My options are [self.tableview addSubview:searchBar] or self.tableview.tableHeaderView = searchBar Both options will scroll the searchbar along the rest of the tableview, which I understand. But is there a way to lock elements up, instea...
L. Steiner
1

votes
3

answer
40

Views

Preload ViewController on application start

I've a heavy UIViewController, which loads multiple images in viewDidLoad (so it's called once, on the first controller access only). It takes 5-10 seconds for it to load, which I want to reduce, preloading it from somewhere on application start. I've done my research and tried accessing the view...
Nikitin Roman
1

votes
0

answer
46

Views

Transferring Data from CollectionView inside TableView to a New ViewController

So I have a main ViewController that has Horizontal Scrolling CollectionViews inside a TableView. When you click on an Item in the CollectionView it transfers all the data from the Item to a new ViewController to display it properly. The problem I am facing is when you click on the item in the Coll...
Aman Chawla
1

votes
1

answer
125

Views

Xcode 9 (Objective-C): Loading Custom XIB causes errors NSUnknownKeyException this class is not key value coding-compliant for the key [duplicate]

This question already has an answer here: What does this mean? “'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X” 66 answers I've been doing .net core stuff lately and I have started again with Xcode (and rusty) this time with Xcode 9. I created a...
VinceV
1

votes
0

answer
104

Views

Presenting a specific view controller messes up the app on device (works on simulator)

I'm facing a very weird bug. I have a button and I'm pushing a view controller normally, using segues. However, when I push the view controller the whole app layout messes up: it sometimes works, sometimes glitches such as leaving me with a blank view with nothing but the tabbar, or previous view co...
Can Poyrazoğlu
1

votes
0

answer
68

Views

iOS: formSheet modalPresentationStyle view controller size shrinked

I'm presenting a view controller with modalPresentationStyle set to formSheet, then I noticed the size of the view controller displayed isn't the same as how it's designed, it looks like iOS tries to shrink it to be smaller. The doc says: In a horizontally regular environment, the view controller is...
hzxu
1

votes
1

answer
28

Views

UIViewController - top misaligned at cold launch on iOS 9/10, ok on 11

I have a UIViewController that contains a UISegmentControl at the top, and a UITableView below. The layout is very simple. The UISegmentControl Top Margin is 16pts from the Top Layout Guide. The tableView is relative to the UISegmentControl. The view is part of a UITabBarController set. The UIT...
Mitch Cohen
1

votes
0

answer
108

Views

How to implement a BaseViewController through storyboard or xib?

Wait, I know this question title looks very duplicated, but it really is not. I have been searching for whole day but cannot find any good solution. Definition of terms BaseViewController: A class that extends UIViewController, responsible for some common behaviors across different subclassed ViewCo...
Sira Lam
1

votes
1

answer
99

Views

Is it possible to intercept all method class on any UIViewController subclass

Let's say I wanted to be able to intercept any method calls to a UIViewController subclass. First of all, I swizzle the +(instancetype)alloc method and I check if the current instance isKindOfClass:[UIViewController class]. If it is I go ahead and instantiate my proxy with the target. ///swizzled Al...
iOSAddicted
1

votes
0

answer
198

Views

Memory leaks with NavigationController and multiple UIViewController

In my application I manage 4 UIViewController : First one for handle user login Second one that display the menu Third one for displaying the action available depending on the user entry in previous view. Fourth one that show details infos about previous selected item on third view. Third and Four a...
Leze
1

votes
2

answer
913

Views

Navigate to next view controller after delay ios

I want to navigate to next view controller after a delay of 3 seconds. It happens, but it happens twice!. This is my code. override func viewWillAppear(_ animated: Bool) { let authToken = UserDefaults.standard.object(forKey:'token') as? String ?? '' if (authToken.characters.count == 0) { self.perfo...
NavodaP
1

votes
0

answer
9

Views

How can i lock screen click mode.

How can I lock screen UI clicking mode. Just like MX Player When we press lock button in MX Player. That stopped working every button (like NEXT, PREVIOUS, PAUSE). How can I do that same.
Abdul Qadir
1

votes
2

answer
476

Views

UISearchBar resignFirstResponder not working

UIViewController needs to hide keyboard inside viewWillDisappear or viewDidDisappear methods. UIViewController stays in memory after disappearing and can be presented again. On first appearance UISearchBar is not firstResponder and keyboard is hidden. But if I pop UIViewController with keyboard show...
JuicyFruit
1

votes
0

answer
126

Views

Programmatic Modal View Popup Swift 4 Confusion

For my project I needed to implement custom popups for a user to interact with. In order to get the popup to display correctly I had to create a UIView, set it's bounds to the desired size, and add it to the presented modal view controller's subviews. I could not resize immediate view of the modal v...
JCoppert
1

votes
0

answer
51

Views

AppDelegate presents views twice

I'm implementing quick-actions for my app and for that I need to present viewcontrollers from the app delegate. I use code like this: let viewController = storyboard.instantiateViewController(withIdentifier :'MyControllerID') as! MyController let navController = UINavigationController.init(rootViewC...
LarsGvB
1

votes
0

answer
79

Views

Present different outlets on the same view controller through navigation controller?

I want to present different outlets to the user for different stages of a registration form. For example they enter their first name and last name, press continue and then go onto the next part of the form to enter their date of birth etc and at each stage of the form I want it to be part of a navig...
Alex
1

votes
0

answer
22

Views

Failed when present UIviewcontroller

I have 2 viewcontrollers: mainVC & listVC. I tapped customized button on mainVC to present listVC, then tapped button on listVC to go back to mainVC. until now there is no any failure. But when I tap customized button to go to listVC again, program failed. error: NSInvalidArgumentException', reaso...
user5359179
1

votes
1

answer
99

Views

iOS Swift, with one common method in protocol and two implementations in two ViewControllers, how to decide which ViewControllers method is invoked?

I have a protocol protocol HandleEmbedController: class { func printMsg() } and 2 container views and 2 corresponding ViewControllers class EnemyBaseVC: UIViewController, HandleEmbedController { override func viewDidLoad() { super.viewDidLoad() } var value1 = '' func printMsg(){ print('printing some...
Isanka Lakshan
1

votes
0

answer
125

Views

In Swift, is it possible to combine both an SKScene and a UIView in the same ViewController?

The app I am creating has a 'Stats' view controller that incorporates typical UI Elements (Labels, Buttons, ImageViews, etc...), but I also want to be able to use a sprite with gravity on that same screen. What is the proper way to set this up? Do I create a View Controller in my storyboard and th...
Justin
1

votes
1

answer
26

Views

ios metadataOutput function cover navigation bar

I have following controller: import UIKit import AVFoundation class ScanViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. //Creating session let session...
Robert
1

votes
0

answer
498

Views

iOS: adding buttons to Toolbar programmatically

I need to create Toolbar and add buttons programmatically. I will have different sets of buttons for diferent screens. That's easy. Also, I need to center those buttons. They should have equal space between them. And also I need that all those buttons separate screen width only between themselfs....
Marksss
1

votes
2

answer
44

Views

View under Navbar bug

I'm using Xamarin Auth via dependency services which presents a new view where the user authenticates However, when the modal page appears and is fully visible, it jumps up and down revealing this black bar It quickly disapears and the page loads like so: where the top of the page is hidden. Thank...
Jim Layhey
1

votes
2

answer
50

Views

Presenting a ViewController from UIApplication subclass

I have a timer running in my UIApplication subclass, that is should send the user to a certain ViewController when it runs out. I am able to instantiate the ViewController I want to go to... let storyboard = UIStoryboard(name: 'Main', bundle: nil) let vc = storyboard.instantiateViewController(withId...
Marmelador
1

votes
2

answer
403

Views

How to access a referencing outlet from a different view controller?

I am new to Swift and Xcode. I am building an Financial Expense ios app. In my first view controller, I created a referencing outlet for a label called expenseNum. In my second view controller, I have a function for a button called Add Expense. When it is clicked, I need it to update the expenseNu...
user9347880
1

votes
1

answer
62

Views

Push UIViewController with Alert without UINavigationController

I have a button in UITableViewController. when I press this button, alert controller appears asks if the user wants to go to the cart page or stay in the same page, as follows, if user?.uid != nil{ let title = 'Item is added to your cart ' let alert = AlertController.instance(title: title) present(a...
Amal Hope
1

votes
0

answer
69

Views

Swift - add text fields and UIImageView with two separate buttons in View Controller

I'm making a diary app where I plan on putting two buttons in a view controller, titled 'Add Text' and 'Add Image'. Using these buttons simply allow the user to add a text and an image whenever tapped and drag and resize them as they please, just like how you do it on Instagram's story. Any other pl...
ciklukylok
1

votes
0

answer
13

Views

Custom transitions between view controllers supporting different/mismatching orientations

Specifically, I have a problem with dismissing view controller B so that view controller A is visible again. Following the steps below, the appearance of view controller A will be heavily distorted. View controller A supports all orientations but upside down. View controller B supports portrait only...
Jonny
1

votes
1

answer
460

Views

Add Tab Bar to all screens even if that screen isn't immediately accessible by tab button

I have a tab bar in my app that has 3 items leading to 3 separate view controllers. However, within one of those pages I have a button transition to another view controller (click on the button and it takes you to another page), and the tab on the bottom is no longer visible. Think of Instagram wher...
Andy Lebowitz
1

votes
2

answer
149

Views

Swift: Add offline bar for all views such as in facebook messenger

I develop an iOS app which data of it provided by an online server, I'm using Reachability to check availability of internet connection, what I need to do now, create a bar such as in facebook messenger which appear in current (every) UIViewcontroller in my project immediately when there is no inte...
Jasica Peter
1

votes
0

answer
81

Views

ViewControllers, memory consumption and code efficiency

My app has the following layout/flow: LandingVC: The page a new user will see when first runs the app. This page will explain what the app is for and has 2 buttons: Login and Register LoginVC: Where the user will use his/her email and password to log in RegisterVC: Where the user will use his/her em...
christostsang
1

votes
1

answer
29

Views

How to refresh Swift UIViewController from Delegate callback

I'm a noob. I have some programming experience, but am new to Swift 4 and Xcode 9.2. I've been taking tutorials and reading. I've implemented one of the many Music Player examples to be found. I've expanded it to display song metatdata. This works fine. I've implemented the AVAudioPlayerDelegate...
Uncle Bill
1

votes
1

answer
94

Views

How to segue with left to right animation and alpha 0 to 1

I just want to go to next ViewController using segue and the next ViewController will come from left to right with alpha 0 at the starting and 1 at the when next ViewController is on display. Here is the code i tried so far without any luck, let transition = CATransition() transition.duration = 1.0...
Deep
1

votes
1

answer
229

Views

Trying to pass data from UICollectionViewCell to UIViewController

Trying to pass data from my collectionViewCell to another UIViewController but for some reason the data is not passed. Below is my code in didSelectItem method and the ViewController to which I want to pass the data. I am trying to populate label with the text passed over from my collection view cel...
Shireesh
1

votes
0

answer
30

Views

Remove the current View Controller from the stack and move to a new View Controller

In my app the first time the user accesses a page it downloads the data for that section. The app sends the user to the download page the first time and after everything is downloaded it continues on the content. I have a very roundabout way of doing it now using Userdefaults. Is there a nice way to...
paul_f
1

votes
2

answer
135

Views

UINavigationController - how to change animation for single UIViewController

How can I have custom animation only for single UIViewController push/pop and default animation for other UIViewControllers in same UINavigationController? I use UINavigationController and push/pop to navigate between different UIViewControllers. I created custom animation and set custom UINavigatio...
vandzi
1

votes
1

answer
22

Views

How to change the root view controller of a uinavigation controller embedded in a uitabbarcontroller?

Please see the attached image. Here I am having a uitabbarcontroller attached with navigation controller which is having a root view as the 'first view'. When I click on a button in the first view it goes to the 'Second View'. At some point, I want to change the root view controller of navigation c...
Chelsea Shawra
1

votes
2

answer
38

Views

Swift adding clickable tableview

When I create a tableview, I cannot click on any of the items I put on the tableview. I was wondering how can I create a tableview that has every item clickable and when the user clicks on an item( say a city name, for example) it redirects the user to a different viewcontroller. ( for example if th...
Ege Berk Akkaya
1

votes
0

answer
25

Views

Inherit UINavigationController to reuse menu button in all UIViewControllers

We want to add a menu button in the top right corner of our Xamarin.iOS app. We know how to do that in each ViewController by setting the NavigationItem object RighBarButtonItem like this: public override void ViewDidLoad() { base.ViewDidLoad(); var menuButton = new UIBarButtonItem(UIImage.FromBundl...
Domi13371314
1

votes
2

answer
147

Views

Animate root view controller transition

I want to animate the transition between one root view controller and another. I could hypothetically perform a segue to the other view controller instead of switch roots, but if possible I would like to maintain the root view controller transition. Here's what I have to do this without animation....
Ben Botvinick
1

votes
1

answer
54

Views

How to present ViewController partially over another ViewController and still be able to interact with the bottom one?

I'm presenting a mostly transparent ViewController over another one right now, but it disables interaction with the ViewController underneath. Here is the code I am using as of now: topController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext bottomController.modalPresentationS...
bigreddawg

View additional questions