Questions tagged [viewcontroller]

viewcontroller is a design pattern which is a hybrid of the view and controller components of the MVC architecture

A viewcontroller responds to events by dispatching calls to a mapping table which matches views and controllers with each event target. It is implemented as an object in many frameworks, including:

2792 questions
7
votes
4 answers

Single View Controller for multiple views

I'm trying to make a registration form with multiple views but only one view controller. After proceeding to the next view I'm writing the input to a struct which will be sent to the server later on. The problem I'm facing is that the VC is…
Raoul
  • 153
  • 1
  • 1
  • 11
7
votes
3 answers

Modal view closes when selecting an image in UIWebView iOS

I'm currently building an app with a modal view popping up that contains a WkWebView. When I want to upload an image within this modal view and the Photo Selection appears, the modal view just dismisses back to the view controller that fired it…
Made by FA
  • 710
  • 2
  • 7
  • 27
7
votes
2 answers

Get the top ViewController in iOS Swift

I want to implement a separate ErrorHandler class, which displays error messages on certain events. The behavior of this class should be called from different other classes. When an error occurs, it will have an UIAlertView as output. The display…
gutenmorgenuhu
  • 2,312
  • 1
  • 19
  • 33
7
votes
1 answer

Adding a view to the window hierarchy

I am trying to create a pause screen on my game. I have added a 'PauseScreen' viewController in my storyboard with the Storyboard ID and Restoration ID set as "PauseScreenID" and to move to the pause screen I have have created the function in…
Ben Oneill
  • 111
  • 1
  • 2
  • 8
7
votes
3 answers

Hide/Show iAds in Spritekit

I've been trying to figure out how to hide and show iAds in my Spritekit Scenes. Currently I have it setup like this: ViewController.h #import #import #import @interface ViewController :…
Negora
  • 281
  • 4
  • 13
7
votes
3 answers

iOS - childViewController not receiving events

Newest Update: I created a brand new project that is built the exact same way as below. However, this test project actually works just fine even though it seems to be the same... One thing I've noticed is that the parent view controller in the…
7
votes
3 answers

dismissViewController: not working

I have a view controller called vc0 which is presented like this: [self presentViewController: vc1 animated: YES completion: nil]; And in vc1 I have a button to present another view controller: [self presentViewController: vc2 animated: YES…
MCKapur
  • 9,127
  • 9
  • 58
  • 101
6
votes
1 answer

Cocoa : How to use NSNib several times independently

I've asked how I can make a custom view repeat itself into several separate copies and have been told that I should use NSNib or NSViewController. I have a custom view in an nib file, whenever a user clicks a button, I want a new copy of the nib…
Elbimio
  • 1,041
  • 2
  • 10
  • 25
6
votes
4 answers

iPhone: Display image at its original size

I am trying to set frame for imageview to original size of image and display it in center of view. I have written following code for this but image still appears in whole screen! Suppose image size is 320x88, it appears resized/stretched to 320x460!…
Paresh Masani
  • 7,474
  • 12
  • 73
  • 139
6
votes
2 answers

What is the proper way to change the name of a ViewController class in Swift?

When I change my ViewController class name after it's been created and assigned to a view controller in storyboards I run into problems with the IBOutlets of that view controller, and Xcode does not automatically show the corresponding class in the…
Austin Berenyi
  • 1,013
  • 2
  • 13
  • 25
6
votes
7 answers

How to correctly manage memory stack and view controllers?

I'm really struggling with this basic iOS programming stuff but I just can't figure out whats happening and how to solve it. I have my main Login controller that detects when a user is logged in and presents next controller if auth…
Karlo A. López
  • 2,548
  • 3
  • 29
  • 56
6
votes
3 answers

Create singleton of a viewcontroller in swift 3

I know how to create singleton class in swift. The best and easy way to create singleton class is the following: class Singleton { static let sharedInstance = Singleton() } But I don't need singleton for any normal class. I need to create…
Poles
  • 3,585
  • 9
  • 43
  • 91
6
votes
3 answers

lock orientation of a viewController in swift

I'm a newbie in Swift and i have a problem locking the orientation to portrait in a viewController. Actually i have locked it using this code in my Custom Navigation Controller override func supportedInterfaceOrientations() ->…
aris ppspr
  • 119
  • 3
  • 11
6
votes
2 answers

update viewcontroller from appdelegate - best practice?

I am playing around with iBeacons implementing CoreLocation methods inside AppDelegate.swift (methods are implemented in AppDelegate to ensure App Background Capabilities) In a SingleView application that comes with "ViewController.swift", what…
Andy
  • 549
  • 1
  • 6
  • 12
6
votes
7 answers

Disable rotation for View Controller in Navigation Controller

First of all, this isn't a duplicate. I've looked at all of the questions related to this on SO and none of them work for me. Hopefully it's just because I'm new to iOS development but I suspect this isn't possible in my case. I've attached a…