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
0
votes
1 answer

UINavigationControllerDelegate breaks pushViewController

I have a view controller where I implement UIImagePickerDelegate and UINavigationControllerDelegate inorder to get an image either from the gallery, or the camera. After picking the image I want to navigate to another view controller. However…
0
votes
1 answer

Where in my ViewController do I put initializing code?

I'm trying to add a FittedSheet (Repo) to my app, and in their Usage explanation, they just have this chunk of code with no further explanation regarding where to put it. let controller = MyViewController() let sheetController =…
rst123
  • 3
  • 1
0
votes
1 answer

how to be back to previous VC or next VC from a view controller inside UIPageViewController?

I have 3 view controllers that controlled by UIPageViewController like the image below https://i.stack.imgur.com/9Lqoj.png if I swipe the screen, it will move from RedVC to BlueVC and to YellowVC. I want make next button and back button in the…
Alexa289
  • 8,089
  • 10
  • 74
  • 178
0
votes
1 answer

UIViewController throws 'unrecognized selector' error

I've created a XIB containing only a UITableView. I changed the parameters of the project to load this view at launch. But I get this "unrecognized selector sent to instance" error I don't know what it is. How do I fix this and get my app to show my…
MrRog85
  • 121
  • 1
  • 9
0
votes
1 answer

how to use customized toolbar in multiple viewcontroller without repeating the code and copying the elements (swift)?

how to use customized toolbar in multiple viewcontroller without repeating the code and copying the elements (swift)? trying to create XIB with the toolbar "i'm asking if I have already customized the toolbar and i need to use it in multi-able…
0
votes
1 answer

Modify View Controller Property from Delegate Method

I'm using Swift 4.2 and Xcode 10.2. I created a custom alert which is a UIViewController called DialAlert. It overlays on top of the current UIViewController and has two buttons, Call and Cancel. When Call is tapped, I report the tap to the…
TM Lynch
  • 403
  • 3
  • 13
0
votes
1 answer

iphone refresh viewcontroller not working when app enters foreground

i have an application with 3 tabs inbox,contacts and settings. In inbox, there is a list of messages from other users ,i update the messages using a function reloadTableViewDataSource, now i have to reload or refresh the messages when the…
sujith1406
  • 2,822
  • 6
  • 40
  • 60
0
votes
1 answer

Access object in AppDelegate from ViewController

In AppDelegate.swift I've declared an NSStatusBar object like this: var statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) statusItem.button?.title = "chess" statusItem.button?.target = self statusItem.button?.action…
hcarrasko
  • 2,320
  • 6
  • 33
  • 45
0
votes
0 answers

How do I put a picture from a JSON URL in the background of a UIViewController?

I have a ViewController and in these I would like to set an image as a background image via JSON URL. I also wanted to present a picture of this JSON request with my JSON request which I already used for my News UITableViewController, but that did…
Shinox
  • 107
  • 12
0
votes
2 answers

Why array's append method cannot be used in viewController?

I am beginner of swift. I tried to use array's append method in my code but it doesn't work. How should I implement the array correctly? The error messages: Swift Compiler Error Group ViewController.swift:16:5: Expected…
Tony Chan
  • 9
  • 2
0
votes
4 answers

xcode4.2 - Swift Accessing Viewcontrollers label from external class

Where is the problem accessing a ViewController: UIViewController label (here: outlet called timerLabel)from AnotherClass. I would like to set a text. class AnotherClass{ //[...] func updateTimeLabel(){ // To Solve!!!******* …
SoTm
  • 807
  • 1
  • 7
  • 10
0
votes
1 answer

Swift: Pass data from a view controller to a navigation controller

I want to pass data from a view controller to another but I've a Navigation controller between them, so there's a "present" function instead a "performSegue". private func IniciarMainAdmin(){ let mainAdmin = UIStoryboard(name: "Main", bundle:…
0
votes
1 answer

clearing variables of root view controller when switching tabs programmatically

I have a storyboard/root viewcontroller as the third tab on my app. On that tab the user selects an image, and writes a caption, which are stored as variables. From the root viewcontroller the user is taken to a preview screen via a segue which…
TJMac
  • 129
  • 1
  • 12
0
votes
3 answers

Problem with transfer of values ​in controllers in Swift

I have login few screens and controllers in my app. First screen is screen with button and moves user to next login view with username, password field and login button. On the controller i have function onClickButton and when i have good data i…
KamilloPL
  • 34
  • 8
0
votes
1 answer

How to remove duplicate VC in swift?

I am making a game, where I go from the main screen to a ArcadeViewController, which loads up the SKScene, and save the previous VC as prevVC. I use segues created in storyboard to move between VC. The problem is that each time I move to a VC,…
Nocturne
  • 31
  • 6