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
9
votes
6 answers

Passing data from view controller to tab bar controller in iOS

I'm developing an iOS app and now I'm at a loss. I'm trying to pass data from the first View Controller to the first tab of a TabBarViewController (with using the storyboard). I found a lot of tutorials that explain how to pass data between view…
Keks
  • 127
  • 1
  • 1
  • 7
9
votes
3 answers

Reference to the segue source view controller

Within my viewDidLoad I would like some custom code based upon the previous controller. How can I access the segue source controller or the previous segue identifier in the destination controller's viewDidLoad to handle this?
StuartM
  • 6,743
  • 18
  • 84
  • 160
8
votes
3 answers

viewController appearing black when appearing

Hi All I'm new to iOS development and am currently having an issue with something, I'm trying to make a login form appear modally if a user is not logged in. I'm using NSUserDefaults to store an id which I'm simply checking if it exists. If it…
Dan Newns
  • 170
  • 1
  • 1
  • 8
8
votes
3 answers

iOS: Go back to previous view

I have two views like this in Story Board: [View1] -> [Navigation Controller] -> [View2] To go from View1(has tableview) to View 2, i do this on click of a row on View1: self.performSegueWithIdentifier("showmyview2", sender:self) This works. Now i…
Jasper
  • 8,440
  • 31
  • 92
  • 133
8
votes
2 answers

ViewDidAppear not called when the modal view is dismissed

First, I create a MainViewController. Then in MainViewController, I do [self presentViewController:modalViewController animated:YES completion:nil]; modalViewController.modalPresentationStyle = UIModalPresentationFormSheet; When I dismiss the…
Gonghan
  • 287
  • 2
  • 3
  • 10
8
votes
6 answers

switching view controllers using swipe gestures

Okay so here is the problem I'm running into: I am attempting to switch from one viewController that I named MenuViewController which contains my menu (obviously). I have a separate viewController named ViewController that contains my mapView. I…
8
votes
4 answers

why only viewWillAppear called on navigation back

I have doubt need to be clear.. I have stack and a navigation controller.now when the stack loads the viewDidLoad viewWillAppear viewDidAppear will be called. when i click some button then this button push me to the new stack , now new stack gives…
user2102546
  • 87
  • 1
  • 7
8
votes
2 answers

presentViewController animation from side

I have a single view App and want to show a new ViewController when pressing a nav bar button in the right hand side. I call this VC by this code: - (IBAction)createEntryButton:(id)sender { CreateEntryViewController *vc2 =…
casparjespersen
  • 3,460
  • 5
  • 38
  • 63
8
votes
2 answers

iOS Integrate PKRevealController with Storyboard & Auto Layout

I'm trying to integrate PKRevealController into an existing project of mine. https://github.com/pkluz/PKRevealController How do I set up my left view controller, right view controller, and front view controller if I'm using storyboard? The readme…
Rohan Agarwal
  • 2,167
  • 1
  • 24
  • 34
8
votes
1 answer

Understanding the use of addChildViewController

I'm working with some code that I need to refactor. A view controller is acting as a container for two other view controllers, and will swap between them, as shown in the code below. This may not be the best design. Swapping the view controllers in…
Gavin Hope
  • 2,173
  • 24
  • 38
7
votes
1 answer

How do I use one xib with multiple view controllers?

In my program, I have a UIViewController subclass MyViewController and two subclasses of that view controller. I want them all to use the same xib so I initiate them as SubClass *SC = [[SubClass alloc] initWithNibName:@"MyViewController"…
WolfLink
  • 3,308
  • 2
  • 26
  • 44
7
votes
4 answers

how to reload tableview of another uiviewcontroller in current viewcontroller

Please help me out. I am very sorry if it is duplicate but i didn't get required answer that is why i am asking again. I want to reload table of anotherview in my first view. Thanks in adavance.
Mobile App Dev
  • 1,824
  • 3
  • 20
  • 45
7
votes
2 answers

How to set initial controller programmatically from storyboard in Cocoa using Swift 4 Xcode 10?

Introduction: I want to create an app that displays some "user guide" on its first launch, I've already finished the part that detects if the app is first launch, but when it comes to the setting view controller part, I can't figure out how to do…
AgentBilly
  • 756
  • 5
  • 20
7
votes
4 answers

Why tab bar is missing after presenting a new view controller?

I have created a simple tab bar with three views in storyboard. The tab bar works well, but when I try to show another view controller from a button within a tab, the new view is placed over the whole screen and also over the tab bar. This is how I…
RjC
  • 827
  • 2
  • 14
  • 33
7
votes
2 answers

How to make cells have a gradient background?

I have inserted a table view on my view controller and I was wondering how can I give the cells in the table view a gradient background? Can I edit each cell individually to give it a different color gradient background for each cell? For example,…
Captain Code
  • 277
  • 1
  • 3
  • 13