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

layoutSubviews called twice when rotating

When my main view rotates I want to re-arrange the sub views, so in my ViewController, I override willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration and set the frames of the subViews in…
Bbx
  • 3,184
  • 3
  • 22
  • 33
6
votes
3 answers

Trying to run code upon a return from a segue

I'm trying to find a method to catch a return from a segue to the root controller so I can run custom code that will make a decision on where to go next. I've tried the two methods below and they don't do the trick as they seem to (obviously) be…
Grymjack
  • 529
  • 1
  • 10
  • 21
5
votes
1 answer

Can we create multiple navigation controllers in iOS?

I am a little bit confused about navigation controllers. In one navigation controller, a large amount of view controllers are present. I have seen so many examples with one navigation controller. Can we create multiple navigation controllers in iOS…
Prasad G
  • 6,702
  • 7
  • 42
  • 65
5
votes
1 answer

How do I change viewcontroller with segmented control in iOS SDK4.2 (storyboard)? need sample code

I found this great sample code about 'Switching Views with a UISegmentedControl'. http://redartisan.com/blog?page=2 (sample code link : http://github.com/crafterm/SegmentedControlRevisited) but this sample code is using xib. I want to re-coding it…
jokor7
  • 611
  • 1
  • 6
  • 8
5
votes
4 answers

Pushing View Controller more than once is not supported?

I am getting the following error whenever I try to switch views like this: -(void)changeView1ToView4 { [self.navigationController1 pushViewController:view4 animated:YES]; } This doesn't happen when the app first loads and user goes directly to…
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
5
votes
4 answers

UIModalTransitionStylePartialCurl half page

I'm displaying an UIViewController by the following way: MyViewController *myVc = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; [myVc setModalTransitionStyle:UIModalTransitionStylePartialCurl]; [self…
user330885
5
votes
3 answers

How to call a uikit viewcontroller method from swiftui view

I have looked all over for the answer to this question and can't seem to find it. How can I call a viewController method from swiftUI (e.g. on a button click)? I have a viewcontroller that looks like this: import Player class PlayerViewController:…
John M
  • 59
  • 1
  • 3
5
votes
1 answer

View outlet was not set? (Xcode)

When trying to run my iPhone app that I am currently building the build succeeds but the application crashes after the start up image and gives me an error that looks like this: 2011-04-06 20:31:38.562 My App[3438:207] * Terminating app due to…
Dan
  • 61
  • 1
  • 3
5
votes
3 answers

Compare two viewControllers swift

I need to compare if two views are the same, I am getting the views like this let viewController = navController.viewControllers[navController.viewControllers.count - 2] let newController =…
5
votes
1 answer

Why do we use [super viewDidLoad] in every viewDidLoad method?

Possible Duplicate: Do I always have to call [super viewDidLoad] in the -viewDidLoad method? Why is the super class' viewDidLoad method called in every viewDidLoad? What work will it do? Is it compulsory?
mayuur
  • 4,736
  • 4
  • 30
  • 65
5
votes
1 answer

Swift instantiateViewController without storyboard ?programming

Is there any way instantiateViewController without using storyboard ? I did not use storyboard.
Kristoff
  • 213
  • 1
  • 5
  • 10
5
votes
3 answers

MAC OS Xcode Swift 2.2 Fullscreen Mode

What Swift code will switch the app to fullscreen? I found references with example code for IOS. I am looking for a code which works for a MacOS app.
FJC
  • 213
  • 2
  • 9
5
votes
1 answer

Xcode jump from viewcontroller.swift to storyboard

I'm working on a large ios app and I'm also a newb. I'm trying to find the correct scene in a storyboard in a large app. I'm in the .swift file and I need a quick way to figure out which scene is associated with that swift controller file. The only…
user441058
  • 1,188
  • 1
  • 16
  • 32
5
votes
5 answers

How to handle multiple remote-notification click in IOS

I am trying to open different view controllers based on notification click but when push notification is received it automatically runs the controller code in background so when I open the app through app icon/notification from notification centre…
moDev
  • 5,248
  • 4
  • 33
  • 63
5
votes
1 answer

How transfer from UIView to SKScene in iOS

I want to develop a game with SpriteKit on Apple iOS platform.My game has a setting page that contains label,button,table view ,... and a game page.In my test, the first page is the setting and when player press "Start", the game will begin.I do not…
Mahdi Amrollahi
  • 2,930
  • 5
  • 27
  • 37