Coding Explorer Blog

Exploring how to code for iOS in Swift and Objective-C

  • Home
  • Apps
  • About
  • Contact

Objective-C Classes and Usage of Variables

Last updated on June 25, 2014

So, for a little behind the scenes action.  The previous post about Header Files was originally going to be about classes.  But then after I started writing, I realized if I continued on to talking about classes, the post was going to be longer than I would want to read, so I decided to just split off the header file topic entirely, and save more discussion of classes for later.  That’s why I wrote about such an esoteric topic as “Header Files”.  I also like the word esoteric, so expect that to show up in this blog every so often.

Anyway, back to what I originally was going to write about, classes.  Classes are probably the most important thing in object oriented programming.  They are the very constructs that objects are created from.  For a physical analogy, lets say that we want to make a “landVehicle” class, by which I mean somethign that could discuss land vehicles like cars, trucks, tanks, whatever.

Aspects of Land Vehicles

  • They have variable speeds to drive at
  • They have an external color
  • They can drive different directions

So, if we had a game that needed land vehicles in it, we may want to write a class that describes them, so that the game can display them or use them somehow.  The first two describe an specific attribute of the land vehicle, while the third one refers to something it can do.  In a class, those first two could be stored as variables, and the third one could be used as a method, to cause the vehicle to drive a certain direction.  We’ve covered methods before, so I am going to discuss some of the details about variables below.

[Read more…]

Filed Under: General

Header Files, A History Lesson

Last updated on June 25, 2014

Classes are a very important part of object oriented programming.  A class is the blueprint for any object in an object-oriented programming language.  It encapsulates variables and methods related to an object, and a program creates instances of objects to work with.  We can discuss specifics about classes in a later post, but for now, I wanted to talk a little about header files.  Classes in Objective-C are comprised of 2 files, the implementation file, and a header file.  What is a header file you may ask?  Keep reading and you will learn, and even if you do know, there might be some useful history you may not know.

[Read more…]

Filed Under: General, Objective-C

Objective-C Syntax Primer 1: Methods

Last updated on June 25, 2014

Getting used to Objective-C Syntax

My previous experience with programming is mostly with languages similar to C in syntax.  So when I started to learn Objective-C, while it is still a subset of C, it diverged in a much different fashion to its brethren.  To give a little history lesson, Objective-C was began in the 1980s, as basically a combination of the languages “C” and “Smalltalk“.  Other C-derived languages include C++ (obviously) and Java.  Other Smalltalk-derived languages include Python and Ruby.  Since I am not particularly versed in Python or Ruby though, the aspects borrowed from that side of Objective-C’s family tree are currently a bit of a mystery to me, hence my trying to pass on what I’ve learned about the syntax.

[Read more…]

Filed Under: Objective-C, Syntax

Interface Builder Issues

Last updated on June 25, 2014

So, I have been doing several tutorials learning how to program iOS, and I have made a few mistakes. I then clean up those mistakes and try something else. I finish up the tutorial as they stated, start up the simulator, and then…. Crash. But how? I did everything the told me to do, their’s works, but mine won’t, what happened?!

Maybe it is from me being so new to interface builder, but so far, it has been kind of hit or miss with error reporting to me. My most recent issue with it, was I was trying to work with a Date Picker so that it would pop up from the bottom when I clicked a textfield, instead of the keyboard. I had to put it into an actionSheet, which is basically a drawer that pops up from the bottom of the screen, similar to how the keyboard shows up. I tried something from a stack overflow post that didn’t work at least for my situation, deleted all of the code, and tried something else. I finished coding that second way of doing it, loaded it up in the simulator, clicked on that textbox, and it crashed with the error: “unrecognized selector sent to instance”, and even with an exception breakpoint, it still pretty much showed up in the main, not very helpful. I tried to put up breakpoints, to stop it before any of my code executed there, but to no avail.

[Read more…]

Filed Under: Interface Builder

NSHelloWorld!

Last updated on July 24, 2014

Welcome to the Coding Explorer Blog.

I am currently learning how to program apps for iOS. While I do have prior experience with C, I am pretty much learning Objective C from scratch.  I bought my first Mac near the beginning of February 2013, so I have owned a Mac for about 5 months now. I have had the iPhone for about 3 years, so I’m not new to that. Nonetheless, I had not even looked at Objective C until the beginning of this year, so this is pretty much the ground floor.

The purpose of this blog, is for me to share what I’m learning as somebody fresh in this. That is also the reason for the name, basically I am exploring how to code for iOS, and I am taking those that want to come along with me. Am I bound to make mistakes and show a suboptimal way of doing things? More than likely, but everybody has to start somewhere. While I am scouring the web to learn how to program for iOS, I want to share what I find, so anticipate plenty of links to people who know how to do this better than I do.

[Read more…]

Filed Under: General

  • « Previous Page
  • 1
  • …
  • 14
  • 15
  • 16

Subscribe to the Coding Explorer Newsletter

* indicates required

Follow Us

Facebooktwitterrss

Recent Posts

  • Error Handling in Swift
  • Creating and Modifying a URL in your Swift App
  • Watch Connectivity in Swift — Application Context
  • watchOS Hello World App in Swift
  • API Availability Checking in Swift

Categories

  • Class Reference
  • General
  • Interface Builder
  • My Apps
  • Objective-C
  • Swift
  • Syntax
  • Tutorial
  • Uncategorized

Archives

  • May 2016
  • March 2016
  • February 2016
  • December 2015
  • July 2015
  • June 2015
  • April 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • January 2014
  • November 2013
  • September 2013
  • August 2013
  • July 2013
  • Terms Of Use
  • Privacy Policy
  • Affiliate Disclaimer

Subscribe to the Coding Explorer Newsletter

* indicates required

Copyright © 2025 Wayne Media LLC · Powered by Genesis Framework · WordPress