Putting Row Data into Cells

Hello,

I am new to coding, so sorry if this is obvious…
I am in iOS Apprentice, Section 2. I just learned to set the Tag field in the Attributes inspector to 1000. The next line in the book, says: bordered width = 30%.
I am assuming that there should be a section in the attributes inspector for setting the border of the label that I just changed the tag to 1000. However, I can’t for the life of me see anything that has to do with border anywhere. How do I set the bordered width to 30%?

Hi and welcome to the forum community @mippster! You could programmatically set a border to a label in (viewDidLoad for example) by using code such as

myLabel.layer.borderColor = UIColor.darkGray.cgColor
myLabel.layer.borderWidth = 3.0

Best,
Gina

Hi Gina. It would be helpful if this was pointed out to set it programmatically because when you are new to all this your first thoughts are to keep searching in the attributes section. I tried to create the iboutlet for the label, hooked it up in the storyboard and added your code but got an error message. Couldn’t find the Swift code source because all I have is the SwiftUI source code. Any help here on how to resolve? @mippster

Hi @geezer, you made a really great point and @mippster I should have mentioned there are two ways to go about setting up the UI (user interface). Either through storyboards and or programatically. I apologize for not sticking with providing an answer with the storyboard since that is what is being taught. @geezer, if you could share what the error message is and or take a screenshot of you code pertaining to the label that would be helpful. As for the source code, reach out to support@razeware.com. They may be of help in regards to finding the UIKit source code.

Best,
Gina

So as I understand it. This line “ bordered width = 30%” shouldn’t be in the iOS apprentice book. The book just throws that line at you with no indication as to how to do the programming for it and it is way to advanced for a person at this stage of learning. So, I am just going to ignore it and move on.

I sort of ignored it and moved ahead, reluctantly. A few lines ahead and the book introduces the ‘viewwithtag’ property. Basically a trick that allows you reference a UI element without an iboutlet. Light bulb went on for me and label.layer.borderWidth = 3.0 worked. @gdelarosa

I got to thinking on the iboutlets we have created thus far and one that was of interest was the webView.

//viewdidload()
let webView = view.viewwithtag(1) as! wkwebview

webView.load(request)

(a small win)

*I am yet to contact support because I don’t understand how the source code is structured.

@mippster @geezer Do you still have issues with this?