May 14, 2018 at 7:33 PM #2697Taylor ArndtKeymaster
The past few weeks I’ve been getting very frustrated with interface-builder in xcode. I am trying to figure out how the heck can I lay out my interfaces using code and not have my app epically crash on me. Does anybody have any ideas on how the heck to do interface building with iOS because it is stopping me from exploring other things because I cannot seem to get it. If anybody has any ideas please poste them here because this is so frustrating to all users that are blind.
May 24, 2018 at 7:53 AM #2701Michael DoiseKeymaster
Hey Taylor, I have been working with Xcode this week, and I have found it to be easier to just avoid interface builder altogether, and build apps through code. I would delete your storyboard, and put this in your app delegate. Make sure you have a view Controller made as a class and use this code to divert from the storyboard.
window = UIWindow(frame: UIScreen.main.bounds) let homeViewController = ViewController() homeViewController.view.backgroundColor = UIColor.red window!.rootViewController = homeViewController window!.makeKeyAndVisible() This will all go in to the didFinishLaunchingWithOptions function of the appDelegate. You will also find this useful for your view controller to make a label.
let label = UILabel() label.frame = CGRect(x: 150, y: 200, width: 200, height: 20) label.text = "Hello World" label.textColor = .white self.view.addSubview(label)
Add this code to your View Controller’s viewDidLoad method.
Hope this helps you some.
- You must be logged in to reply to this topic.
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to print (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on Pocket (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to email this to a friend (Opens in new window)