Labels

Sunday, February 26, 2017

XCode Understanding Update: (2)

Over the past week or so, I've been focused on learning different parts of XCode without diving into programming at all. I learned how to set up different types of projects, use different types of navigation in those different projects, add picture and buttons, change various settings on all of everything, and more.

The first thing I learned how to do was make an extremely simple app that was simply one page with some text. As it was my first project, I had to call it 'Hello World' because that is really just something that all programmers do with their first project in a new language. So, I made a new project, and inserted what is called a View Controller. They are essentially what you see when you open the app. On the View Controller I added a Label that said "Hello World" and constrained the label to the center of the screen. 

After that, I wanted to learn to make something more complex, so I looked into making buttons to go between different pages. I learned to make buttons and how to point them to different pages, but found it to be extremely inefficient and not look very nice at all. The solution came in a tutorial about Navigation Controllers. They allow you to have a bar at the top of the screen that keeps track of the different pages you've been to, and let you go back to previous pages. With Navigation controllers, all I had to do to link two pages was add one button that led from the home page to the sub-page. With this concept, I created an app that has a picture of an eagle as the home page, and has invisible buttons on the eagle's head, wings, talons, and tail that all link to different pages that have more information about those specific parts of the bird. It looked clean, worked well, and created a nice web of pages that all stemmed from a home page. 

However, I had a problem with how all of the pages had to be accessed from the home page. With that specific application it made sense, but I thought to most other applications and websites, and most of them have a clear navigation bar at the top that allows you to pick the different pages you want, and still be able to see the other page options no matter what page you're on. After some self-exploration within XCode, I discovered Tab Bar Controllers. These are the controllers (As explained here) that add the bar to the bottom of the screen with a list of each different section within an app. I learned how to use Tab Bar Controllers by myself without any tutorials (I was able to because they are fairly similar to Navigation Controllers), and now have a great understanding of them. However, I don't think I'll do this type of self-exploration in the future because it really frustrated me when I couldn't figure something out, and tutorials really help because they give clear instructions on how everything must work. 

With the knowledge of both of these new controllers, I attempted to mesh them together. Through about an hour or so of meddling, I was able to make it work by starting with a basic app that used the tab bar navigation to switch between the pages, then embedded the Tab Bar Controller in to a Navigation Controller and put everything into a big web of navigation. It worked to an extent, but there are still some bugs to work out.

During the next week, I will attempt to learn various aspects of Swift (the programming language used in iOS), and how to implement the code into apps. However, I think this may take more than the allotted time, because, from what I've seen so far, it is very complicated and uses little of the programming skills that I've used in the past. Everything has to be connected to a part of the View Controller somehow, and the code is written very differently from the languages that I know. Nevertheless, I'll do my best to understand the basics.

PS: I'm open to app ideas if anyone has one that I'd be able to accomplish :)