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
42
votes
7 answers

Cannot call value of non-function type 'String'

I'm trying to pass the ILTItem variable into my ILTViewController, triggered by AppDelegate.swift when the user launches my app via a deeplink. The code I have errors with: Cannot call value of non-function type 'String' on the line where I define…
James
  • 1,088
  • 3
  • 11
  • 29
33
votes
1 answer

Equivalent of Fragment (Android) in iOS

I want to know if there is a way to use some view controllers within a view controller which provides the same functionality as Fragments in Android? I want to use custom view controllers so I do not want to use NSTabViewController,…
Sarasranglt
  • 3,819
  • 4
  • 23
  • 36
31
votes
6 answers

How to Sign Out of Google After Being Authenticated

So my app has the option to sign in with Google. Upon clicking the button that Google provides, a web view opens and has the user input their credentials. After allowing the app to access their information the app then signs the user in and changes…
About7Deaths
  • 681
  • 1
  • 5
  • 16
28
votes
2 answers

Adding swift file to new view controller in xCode? (easy)

I'm just starting out in xCode 6, and I can't seem to figure out how to add a new swift-file to the new view controllers I add in the interface builder. Any tips on how to proceed would be appreciated.
martin
  • 1,894
  • 4
  • 37
  • 69
26
votes
5 answers

UIScrollView prevents touchesBegan, touchesMoved, touchesEnded on view controller

I am handling touches for a couple of my UI components in my view controller (custom subclass of UIViewController). It has methods touchesBegan:withEvent:, touchesMoved:withEvent:, and touchesEnded:withEvent:. It was working fine. Then I added a…
morningstar
  • 8,952
  • 6
  • 31
  • 42
25
votes
2 answers

Difference between presentModalViewController and presentViewController?

In iOS 5 SDK, there're two methods of UIViewController, presentModalViewController:animated: and presentViewController:animated:completion:. What's the difference between these two method? The documentation says: The…
YuAo
  • 1,427
  • 1
  • 10
  • 17
25
votes
1 answer

Difference between a Scene and a View in iOS

I'm new to iOS I'm having trouble understanding the difference between scene and a view. Unfortunately Apple's documentation isn't helping me. I read that a scene is what you see on the screen. But isn't that what a view is? Are these two…
CGTheLegend
  • 734
  • 1
  • 7
  • 19
21
votes
4 answers

Swift: How to access in AppDelegate variable from the View controller?

I would like to write in the text or csv (prefer) file the variable from the view controller. Indeed I am doing a drawing app and I would like to write in the file the current position of the finger. class ViewController: UIViewController {var…
Yann Amouyal
  • 211
  • 1
  • 2
  • 3
21
votes
3 answers

Open Specific View when Opening App from Notification

I have just added push notifications to my app. I'm wanting to have so that when a user opens the app from a notification, it will open a specific view controller and not my rootViewController. Here is my AppDelegate: #import…
raginggoat
  • 3,570
  • 10
  • 48
  • 108
20
votes
12 answers

setValue:forUndefinedKey:]:

FinalViewWithSending *newView = [[FinalViewWithSending alloc]initWithNibName:@"FinalViewWithSending" bundle:nil]; newView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:newView animated:YES]; //it…
Szwedo
  • 354
  • 1
  • 3
  • 15
19
votes
3 answers

Deleted class drops error message unknown>:0: error: no such file or directory:

So me and some friends working on a bitbucket project and already realized that bitbucket sometimes doesn't sync all the files. But here is what happened: I continued working and created an class, I basically copied an old View Controller (called…
makle
  • 1,237
  • 1
  • 15
  • 21
18
votes
4 answers

iOS - Toolbar not showing

Using the storyboard I created a new screen for a second View controller and added a Toolbar at the bottom. But when the view is shown, the toolbar doesn't appear. I'm using Segue to change views. What could be wrong?
Mauricio Zambon
  • 695
  • 2
  • 9
  • 17
18
votes
2 answers

How to create a confirmation Pop Up when pushing Back button in iOS?

I want to add a pop up when someone pushes the "Back" button of my iOS App, to ask the user if he really wants to come back. Then, depending on the user's response, I would like to undo the action or proceed. I've tried to add the code in the…
recasens
  • 331
  • 1
  • 2
  • 8
17
votes
3 answers

Understanding View Controller Nesting in iOS

Ive been tearing my hair out over the last couple of days trying to understand this one seemingly basic concept of iOS development: If I want to have two or more View Controllers displayed and usable in the same "screenful", is this: Not advisable…
Adam Eisfeld
  • 1,424
  • 2
  • 13
  • 25
17
votes
2 answers

Class has no initializers: Swift Error

I have a problem with my ViewController. My code has an error about initializers and I can't understand why. Please, take a moment to look at my code: import UIKit class ViewController: UIViewController, UITableViewDataSource { let…
iGermanos
  • 181
  • 1
  • 1
  • 6