Questions tagged [viewdidload]

Method in UIViewController class (Apple iOS SDK) for managing the view. Called after the controller’s view is loaded into memory.

This method is called after the view controller has loaded its associated views into memory. This method is called regardless of whether the views were stored in a nib file or created programmatically in the loadView method. This method is most commonly used to perform additional initialization steps on views that are loaded from nib files. Available in iOS 2.0 and later.

722 questions
4
votes
4 answers

Swift 3 / Xcode 8.2 - switch view in viewDidLoad not working

I want to switch the ViewController on load when the user is already logged in. The problem: The view didnt change when user is equal to "true"... Thank you in advance!! override func viewDidLoad() { super.viewDidLoad() var user: String? …
KMax
  • 65
  • 1
  • 6
4
votes
1 answer

Get parameter from URL Scheme - Swift Xcode

I've made a URL scheme in the Info.plist to call my app, but the URL also parses a string of data which I need to read. After looking around for a little while I've found - http://www.informit.com/articles/article.aspx?p=2301787&seqNum=2 with the…
Gerwin
  • 1,572
  • 5
  • 23
  • 51
4
votes
2 answers

How can I call viewDidLoad in a UITableViewCell?

My code: import Foundation import Firebase class CellOneViewController: UITableViewCell { @IBOutlet weak var new1: UILabel! let ref = Firebase(url: "https://burning-heat-8250.firebaseio.com/slide2") func viewdidload() { …
Gabe Zimbric
  • 47
  • 1
  • 6
4
votes
3 answers

UITabBarController: viewDidLoad not called for all sub tabs

I have a Storyboard-based iOS Swift app that has a UITabBarController as the main view controller which in turn has four tabs. When initializing, I want to pre-load all of them in order to have them register in my global data, like this: Main view…
Stefan
  • 1,036
  • 10
  • 32
4
votes
1 answer

Transition via segue to a certain ViewController depending on whether user is registered/logged in or not. IOS

I need to create and application, that while loading doesn't require user's registration, user can work with limited application's functions. If user is registered/logged in, we need to show him more functionality. Conditions: Application must have…
adnv
  • 101
  • 2
  • 6
4
votes
4 answers

UIImageView blinking animation

I am trying to make a UIImageView blink upon viewDidLoad. I am not sure what the best way to do this is. I've tried using loops with .hidden=YES and .hidden=NO but this seems like a bad way to do this. I need some proper advice.
Owen
  • 69
  • 1
  • 4
4
votes
3 answers

Rounding Corners of UITextField in ViewDidLoad only affects the left corners

i am trying to round the top and the bottom border of two UITextField The result in ViewDidLoad() The result in ViewDidAppear The problem is ViewDidAppear makes the border changes after half a sec of loading the view which is not good in my…
Amr Mohamed
  • 2,290
  • 4
  • 20
  • 39
4
votes
1 answer

Call reloadData on multiple UICollectionView at the same time

I have a sample app with single view controller. The controller's view has subviews look like following UIView UIScrollView -- (Frame = {0, 0, 320, 480}) UICollectionView -- (firstCollectionView, Tag = 0, Frame = {0, 0, 320, 480}) …
Tar_Tw45
  • 3,122
  • 6
  • 35
  • 58
4
votes
1 answer

Changing NSLayoutContraint constant in viewDidLoad or viewWillAppear don't works

I am trying to do something like this: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; NSLog(@"%@", self.tableViewHeight); self.tableViewHeight.constant = 0; NSLog(@"%@", self.tableViewHeight); …
k06a
  • 17,755
  • 10
  • 70
  • 110
4
votes
6 answers

viewDidLoad (and loadView) is not fired after the view controller is pushed into navigation controller

viewController's view is not loaded just after that viewController is pushed into navigation controller. This is my code snippet. - (void)myMethodInClassA { // window's root view controller is navigation controller UINavigationController…
minorblend
  • 905
  • 1
  • 10
  • 23
4
votes
3 answers

perform selector after delay only called once

I have an app in which i need to call an instance method after every 1 or 2 seconds. Now if i place [self performSelector:@selector(getMatchListWS) withObject:nil afterDelay:1.0]; in viewDidLoad: or viewWillAppear: , the method getMatchListWS is…
user2268539
  • 173
  • 2
  • 3
  • 14
4
votes
1 answer

init method vs. a viewDidLoad type method

What is the general guideline for the difference between the types of code (object allocation, setting up ui elements, network calls, etc.) that should go in the init method vs. a viewDidLoad type method for a view controller?
NSNolan
  • 1,025
  • 1
  • 13
  • 18
4
votes
4 answers

What runs before viewDidLoad?

I need to set and store some NSUserDefaults data that can be used withing a View. This doesn't work using viewDidLoad. Can this be done? What method could I use before viewDidLoad? What would you recommend?
Edward Hasted
  • 3,201
  • 8
  • 30
  • 48
4
votes
3 answers

UIImagePickerController not loading in viewDidLoad for iPhone SDK

I'm trying to show a UIImagePickerController as soon as one of my view controller loads. I'd like to this without the user having to press a button so I overrode the viewDidLoad method as follows: - (void)viewDidLoad { [super viewDidLoad]; …
aloo
  • 5,331
  • 7
  • 55
  • 94
4
votes
2 answers

How can I set the titletextattributes for a UINavigation bar for just one view controller?

I'm trying to change the font size of just one of my view controllers because it lends itself to more text, thus requiring smaller font size than my other views. I am setting the navigation bar attributes in the appdelegate during…