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

Swipe Action Happens Before Seeing Button - Swift Coding

I have an edit button, that you swipe right to see, that takes you to another ViewController. But when I swipe right it instantly takes me to the ViewController instead of revealing the edit button (Sometimes I get a glimpse of the edit button…
sckring
  • 31
  • 5
0
votes
0 answers

Xcode error message: 'No visible @interface for 'UIAlertAction' declares the selector....'

So, I am trying to make an app with a passcode lock on it for my iPhone (iOS 12) on Xcode 10. I am in the ViewController.m file and am trying to run the code: NSString *passwordString = [NSString stringWithFormat:@"1234"]; //CHANGE PASSWORD…
0
votes
2 answers

Swift - Why should I use viewDidAppear rather than viewWillAppear when redirect user if the user logged in already

I'm making twitter client app, using TwitterKit. The initial VC is loginVC with login button. After login, it presents tableviewVC that shows list of tweets. I want to redirect the user to tableviewVC directly if the user logged in already before…
0
votes
5 answers

How to add views while using a function in a separate class in Swift?

I created a new Swift-file with a class which holds a function which should add some UILabels, UITextFields and an UIButton to the viewcontroller. When this code is in the ViewController it works, but in the separate file I get some error…
Emile
  • 41
  • 1
  • 9
0
votes
2 answers

Swift: Can't push to view controller programatically

I'm trying to push to different viewcontroller programatically using this code: let loginVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LoginViewController") as!…
0
votes
0 answers

error with very basic example - swift - Attempt to present on whose view is not in the window hierarchy

I'm practicing with a basic example of alerts, it's two ViewControllers, each one has a button to go to the next or return, and another button to show an Alert I added a Simple Alert in the ViewControler1 and it works fine, but if I add a Simple…
Zeus Tune
  • 11
  • 4
0
votes
1 answer

Change View Controller in Tab Bar Controller (Swift)

A little background: My app pops a View Controller that has questions. When the person has answered the question, they swipe and View Controller is presented again, this time with new questions (so it is View Controller with question set 1 -> swipe…
0
votes
0 answers

I want my buttons and BG to stay in one position as the view controller elements transition

I have been working on this for hours(today)/months. I just want my BG to stay permanent in all view controllers as well as the same buttons with the same commands for all of them. It is only the foreground element that is transitioning around in…
Vi Newson
  • 1
  • 1
0
votes
1 answer

Swift Closing and Then Opening Results in Loading Twice

I looked at several solutions on SO but none seem to work. I have a problem where when I open and then close an app, it "loads" twice in a row. Is there a way or code to stop this from happening? The app is configured in such a way that when a user…
rengineer
  • 349
  • 3
  • 19
0
votes
1 answer

Swift: "Use of undeclared type" when trying to push to existing view controller

so I'm trying to push to existing view controller on the storyboard programmatically ,but I'm getting Use of undeclared type: LoginViewController even that I set the Storyboard ID to LoginViewController here is my code: import UIKit class…
0
votes
1 answer

How to show Tab Bar Controller?

I've tried everything to get a tabbar controller onto MainViewController and nothing seems to work. Just a quick rundown on how app works: Storyboard entry is AppContainerViewController and if user is logged in then MainViewController appears as…
Ben
  • 138
  • 10
0
votes
1 answer

Class has no initializers when using POP on a variable

I want to apply protocol oriented programming in one of my applications. I created a protocol called "CustomAnchor" to get rid of the huge amount of commands, needed for Autolayout. But when I assign this protocol to a constant e.g profileImage, the…
Noodledew
  • 509
  • 4
  • 19
0
votes
0 answers

How to block ViewController Screen to not slide to sides

I've created a Screen on storyboard but the problem is that if I keeping pressing click the screen can slide to sides, I don't want this. How I block?
Augusto
  • 3,825
  • 9
  • 45
  • 93
0
votes
1 answer

Performsegue from another viewcontroller doesnt' work

I've been using objective-C so far and decided to develop with swift since now. I have no idea why this simple code doesn't work. I have two viewControllers as container view from superview, one is called 'sideViewController' and the other one is…
0
votes
2 answers

How to continouse pass value from one ViewController to second Viewcontroller and automatic close, dismiss 2nd ViewController

I try to pass data from one ViewController to secondControler however seem it not work. I use NSNotification. - 2 Controller have same class "ViewController" In viewcontroller.m - (void)viewDidLoad { [super viewDidLoad]; …