UILabels do not show up in iOS 8.2 Simulator and Xcode 6.2


#1

UILabels in the Bouncing Labels lesson do not show up in the iOS 8.2 Simulator - iPhone 6. Only the white screen is shown after showing the Copyright at the bottom. I have iOS 8.2 (12D508) and Xcode 6.2 (6C131e) on Mac book pro 2011. Any suggestions? I can’t continue with the lesson with a blank screen. Thanks.


#2

Paste the code, please.


#3

I know viewDidLoad is executed since println is executed.

This is the same code as in the lesson video.

class ViewController: UIViewController {

// 1. Declare ivars
var myFirstLabel: UILabel!
var iPhoneLabel: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    
    // 2. Create the labels
    myFirstLabel = UILabel()
    myFirstLabel.text = "My first"
    myFirstLabel.font = UIFont.systemFontOfSize(36)
    myFirstLabel.sizeToFit()
    myFirstLabel.center = CGPoint(x: 100, y: 40)
    view.addSubview(myFirstLabel)
    
    iPhoneLabel = UILabel()
    iPhoneLabel.text = "iPHone app"
    iPhoneLabel.font = UIFont.boldSystemFontOfSize(48)
    iPhoneLabel.sizeToFit()
    iPhoneLabel.center = CGPoint(x: 200, y: 90)
    view.addSubview(iPhoneLabel)
    
    println("Showing yet?")
}

#4

Hmm… I won’t be able to test it until later, but it does look alright.
Can you do me a favor and remove

myFirstLabel = UILabel()

and

iPhoneLabel = UILabel()


#5

It seems code is executing correctly.
Maybe some configuration issue?

fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb)


#6

@Paul and @ravenshore

I did read something about a change to labels in one of the new updates. Not sure if that impacts this, but you could try adding the label to the view before you size it.

I can’t remember off the top of my head if that’s in Xcode 6.3 or 6.2.

Something changed with sizing behavior – is that what you’re seeing?


#7

I just tested the code without doing any changes on iPhones 6 and 5 and I can’t see any problems…


#8

No, changing order did not make any difference.
My iOS Simulator comes up with black screen, Safari icon, white screen with Copyright string at bottom, and then white screen. There is no Carrier signal icon, time, battery icon at the top. Is there anybody using iOS 8.2 and Xcode 6.2 and OS X Yosemite combination? I simply followed the 1.3 video and did not make any additional changes in Xcode.

Also this morning, 1.3 Tutorial - Add Text Labels in Code is locked with the message, “Lecture contents locked”. I can access up to 1.3 ok. What happened over night?


#9

I don’t think I’ve tried 6.2
I jumped directly to 6.3 beta. You wanna try and update and then test ?
Also did you try to create a new project and then just paste the code in the UIViewController ?


#10

Solved. It turned out to be screen resolution issue. The simulator screen is so big in my 2010 MacBook Pro 13.3 inch display (1280x800) and the missing UI components were shown in the top half of the simulator screen. I had to scroll up to see them after touching the screen with two fingers and discovering vertical scroll bar. I set the iOS Simulator->Window->Scale to 50% and the entire screen is shown now. Thanks for your help.

The “Lecture contents locked” problem has something to do with the account tracking between iphonedev.tv and stackskills. If I enter the tutorial via stackskills, it works fine.


#11

Oh, yeah, you won’t be able to see the full resolution in 100% on a 13" :smile:
You gotta keep it at 50% :wink:


#12

@Paul email me about the iPhone course access (PaulSolt@iPhoneDev.tv) – most of the links on this forum link to the learn.iPhoneDev.tv site.