iOS Programming – Lecture 1

alright so this is going to be your mini introduction at the speed of light to iphone and ipad operates I thought I will do the examples tonight instead of all focused primarily on the examples on Wednesday because I don’t want to rush through those but I’ll rush through this dry material about the introduction because this is your first day of class so you have to get dry material that’s the requirement I already went through what we needed actually we need an a macbook we need xcode you need lion or higher if possible and you get from the App Store don’t download it from some crazy site but there’s a lot of crazy sites out there so you download xcode it’s gimmicks no here fill this form out fill that form at you never get there you know it’s only available legitimately from Apple the operating system is only available legitimately from Apple as well because you’ll see when you guys with your Windows computers the first thing you’re going to do tonight or tomorrow xcode for windows how do I Macintosh you know I haven’t how do i how do I figure this out because I’m not gonna bike apple computer I refused by up computer above the law and you’ll see all these download bit torrents and stuff for all of these ISO images of lion and again full of viruses full of hoaxes full of fill this form out fill out form out if you get to be very cautious about what it is you’re downloading actually is and also can probably get fined heavily if Apple ever finds out because X code is not expert is free operating system is not free lion is cost money so it’s not that much money it’s like 15 bucks now if you’re upgrading or one hundred dollars hundred fifty dollars to buy it from the store it’s not that expensive but there is it’s not free so whatever you’re getting is illegal it’s like downloading you you know PDF a didn’t buy or something and it’s full of viruses full of problems issues so just do things legitimate like okay that was your introduction and so it’s the same way if so what we’re building for is the iOS which is why I keep saying iOS 5 iOS 6 where I was five right now when is ios it’s the operating system for the mobile platform it’s not OSX its iOS which is the operating system friends and the Apple TVs the iphones the iPads all of the lower ones it’s built off of OSX actually it’s a variation of it it’s linux based with a linux kernel that runs just like OSX but it’s a mini version of it so when you go into Xcode and if you’re in the objective c class you can compile for the macbook for a Coca interface which is on Mac which is similar to mfc for Windows you can follow that parallel or you can compile for iPhone iPad you can actually do both in the same price well on that same project it’s great different project types and we’ll get into that I’ll say that for Wednesday so the languages used to develop is objective-c very see like you can actually write C++ code in in it as well and you can use C++ notation as well although you should really be using objective-c for it because who knows how much longer that will be supported and true iphone developers use objective c and this is not a workshop so you don’t worry about that i basically used my class notes for the workshop so some indication on that previous slide about the workshop well that was because it was recycle that’s why i asked if anyone was in the workshop they’re going to be bored if you were so iOS is an OS is a subset of OSX the OS sdk is the software development kit so that applies you get that automatically so in the old days you downloaded xcode and then you downloaded the sdk now it’s just all in one which is really simple the emulators and everything all in one and they run really nicely so you’ll be very happy at that part iOS is a multi tasking runs on different devices as well apple provides the ID the ID is xcode don’t fight it just use xcode xcode is an ide is used by iOS and OS x it does not run on ms windows xcode provides an interface to the compiler the ended debugger and the co profiling tools device features just like the android we have a database on there we have SQLite in fact you’ll find a lot of similarities and concept so it’s nice if you know any mobile device development of your in the Android class it’s nice because then you’ll see like help Apple thinks and how Android thinks you can kind of compare and contrast and then once you can do that then you can kind of you know it didn’t you have a better understanding of the overall features everybody’s got SQ alight everyone’s got a database on their native I started a little bit different on the iphone now and we’ll talk about

that the course a media support as well everybody to hit as many support in fact you’ll find that iphone is more automated less work to do media on the iphone on the android is like pulling teeth my phone bill did nice actually even the database stuff is nicer on the iphone and the GUI screen and the navigation is nicer on the iphone in fact iphone development is easier than android or in prom is objective see if they can figure out and they have there’s third-party tools that allow you i’m trying to think of the name there’s a couple of them that we’re on the tip of my tongue a few minutes ago I can’t remember them right now there’s a couple of IDE pack integrated development environment packages that allow you to use other languages like you can use HTML and JavaScript and you can use a phonegap phonegap is one of them phonegap is really nice I remember cuz I’m meaning to play around phonegap for another project you create one app and it compiles for iphone android all of these of it because the problem with the iphone development is that objective c it’s too hard for some people to grasp it’s most like if you have if you’re not a if you’re not a c++ developer you’re not a see didn’t grow up with see in computer science you can’t learn it as easy as java so it’s not quite as is transferable in terms of skill set however there’s a ton of third-party tools because everybody can do the GUI the GUI is real easy easier than android there’s a lot of third-party tools that will translate your code so you’re right it in this and it gets converted to objective-c so there are third-party higher level well I prom with those tools and there’s a ton of them out there including this one called phonegap that I’m going to investigate recent links i actually haven’t used it but i’ve been hearing a lot about it that supports html5 and a lot of other kind of tool sets and problem with that is you’re adding you’re adding weight to the app the final product is much bigger bulkier heavier slower running than a native app so what we’re going to be doing in this class is native app development although you get to cut and paste most of the objective-c code you won’t actually have to write it yourself a lot of the a lot of the art is in the design because you know Apple is all about industrial design anyway isn’t and the design tools phenomenal with a very little background you can actually create some pretty interesting native apps that are pretty full functioning Swift look a lot more professional than those android apps so and ray nice but and easy and you can do a lot of programming with java and android but most of the apps don’t quite look as professional they don’t have that clean polished look to them this iphone does which is you know the same thing can be said for the product actually a lot of people like the iphones and the ipads because they’re they’re beautiful yeah there are clean lines and shadows you know all of the different features of the fonts and everything you just don’t get the same thing and the displays are nicer to you don’t get the same thing on an android but you can do anything you want on an android it’s open source iphone not open source not okay so gsm hardwell we look at the bluetooth the edge the Wi-Fi all the things we did in the android class looking at the different features and we get to spend more time on that stuff in this class however because we don’t have as much you know gooey stuff and components and things layouts and layouts and stuff like that it’s a simpler the iphone camera gps rich development vironment including device simulations and tools you’ll love the developer tools you’ll love the emulator as well the iOS SDK it’s for free it’s only available through the apple mac store and build to submit the app store well ninety nine dollars a year if you want a basic account don’t bother doing it until you actually after you take this class then do it because then you’ll know for sure whether or not you want to get into this man in a week course you’re probably not going to not going to just you know probably not good probably can decide whether or not you’re going to continue and what’s going to take us a lot of practice like anything you can’t like learning programming from listening to me you can’t learn development you have to actually do it so so what we’re going to do on wednesday is get started with the Xcode development and write a HelloWorld and write another app and the same thing that we’re going to you know same thing that we basically did with the Android classes get your hands dirty so if you bring your computer on Wednesday we’re going to go through I have to stop in the slide set because this is going to starting with the first project but let

me just give you a preview of Xcode and what you want to do to prepare yourself for this class when you download it i did when i download it i just got the basic one I didn’t download all the extra stuff and then there are some students who download all of the extra stuff along with Xcode and the extra stuff is I hope I still have the link up here I still do all this other stuff is extra stuff you can get most of this extra step through Xcode assuming that some of you haven’t downloaded this yet you might went interested in knowing that you’re probably only going to want two things out of here you’re going to want the X code basic 4.3 you’re going to want to come in like tools because i’m actually going to start using some of the command line tools in this class only because it can kind of show you in there GCC command line tools but here’s the trick so you’ve downloaded xcode because you taught you know you someone said you needed to do that and i can’t close this window okay and here’s a preview actually what we’re going to do on wednesday this is a screen by screen shot screenshot because it they were all done on a mac and actually did screenshots quite easily on the macbook but the reason why I have this up as I want you to not have to worry about installing a lot of stuff so what you’re going to do is you know download the base system you’re going to open up Xcode hit preferences up here on the right-hand corner references you’re going to click on the download tab and I’ll let me get back to that other screen here we go and this is what I’m talking about with the iOS versions so if you know you’re going to have code from previous iOS versions like for example i have actually the device debugging support for three point oh four point oh four point three the simulator for 4.3 i can actually download the 3 point O simulator as well because what’s going to happen i’m running to use a computer in the library and it has three point 0 on it and i’m going to get your project and i want to be able to look at it so in order for me to open it up I got to go and you know get the iOS support for it the debugging and troubleshooting support there’s a 5.1 i only have five point 0 which is not a problem actually because 5.1 hasn’t been out that long it’s that one I told you that got updated like overnight last month or so but long story short check and install now is the option that you’re going to do you’re going to get over here is cuz i uninstall and it’s going to be buttons install install this is so much easier this is so much easier to do than going through the website and downloading each one of those dmg files and saving them and then loading them because you’re duplicating efforts because some of the stuff will be installed automatically with Xcode now when you do this it’s going to take you about half a day it’s going to take you four or five hours so don’t do this on Wednesday morning if you want to bring it wednesday night so do this like you know tuesday and plan on doing it while you’re doing something else the xcode version on this Wi-Fi system here which is faster than my house took about four hours for the download to work which is long although i was downloading a lot of stuff at the same time not bloating and stuff like that and using the computer you don’t use the computer actually about three hours to three hours probably for the main exco to download this is going to take you about 45 minutes to an hour for each thing that you’re going to install on top of that so while you’re working you know or while you’re doing something else and you know hook it up watch it play after the install there’s nothing there’s no configuration it’s not like it’s not like the android stuff where you have to install eclipse and then you have to install the Android tools and yet I have to go and go view box I’m going to go not that complicated this is simple it’s just time consuming so more time consuming than the android stuff so anyway I was show you this download for a reason because a lot of people install it and what ends up happening is once you’ve got extra installed actually here i’ll just show you something real quick my new project and then i come in here and i go i want to create an iOS application but actually actually this is where the command tools are coming into place this is under the OSX side of the fence here these options are going to change depending upon what you’ve got installed so if you’re looking at a book you’re looking at an example and you’re in here and you don’t have something that’s in here your iOS version is probably different than the book or the website that you’re looking at or you

have to upgrade I mean basically just select go into preferences and click that button and see what’s new is most likely you’re missing something because what you’re getting now which is why there’s executables so small I believe because excuse me the download is now a 1.4 gigs doesn’t have anything in it the old days used to be like three to four gigs in size it was loaded with all this stuff so they pulled everything out it made it separate downloads and they make that Spile smaller to download xcode based system smaller plus nobody wanted to install that when they didn’t want they weren’t going to use it so okay strategies a little different now so if I come in here however it’s kind of easy if I select as an example single and that you might want to do this just to check your installation as well if i click on iOS which is what we’re going to use for this class the objective c class is going to use mac OS x I can compile for both it’s the same language if I click there’s an example single View application and click on next and I just fill in some stuff here I’m just going to say hello I’ll go through with this and a lot more detail on Wednesday when we do hello world I’m going to notice immediately I’m going to have iPad iPhone or universal if I put it on universal and leave it on there next time I go win it’s going to be on there and if I go next I’m just going to create a hollow world just this is good create put it on the desktop if I look up here on the left-hand corner of the screen this is because I’m right now I’m just going to show you how to test out your installation make sure you’ve got what you need to get i have the ipad 5.1 simulator ok if i click on this little button here it’ll tell me what simulators i have installed so as I’m following through the example if I go oh I need a previous simulator I only have simulators for 5.1 on your actually and so then I means i need to upgraded to get the 4.3 year to get the to get the lower ones otherwise i may or may not necessarily have the same effect the same working type of project so up here is where i’m going to get to see what actually have installed what I have actually working with and then it’s easy because I just click on the run icon as an example here I’m going to have a little bit of compilation going on here are you check out how fast the simulator loads it’s an iPad simulator cuz icicle when I selected I guess okay how fast that loads well should load my application to I got the little round up there we go here we go hello all right well it was just a plain application so you can see the top here actually because I have it landscape mode there we go that’s all fast ambulator runs so if you’re in the Android close you know it would be like 10 minutes later something would have shown up on the screen so then I can switch it here let me just shut the simulator down just put it on a pie foam device there we go then I’ll get a picture of an iphone in seven iPad who’s gonna get the iphone that comes up so it looks pretty realistic in terms of an iphone actually and that loads up pretty quickly there’s nothing there’s nothing this is a blink application but it looks pretty realistic that so a lot of people are very happy with the simulator emulator actually Android calls it an emulator I phone call it a simulator it’s an emulator and because you can you have full internet access if actually have more support on this emulator than you do it’s still configured for i2 and you have more features in this emulator that you do that you’ll have in any Android emulator so this is a lot more feature-rich because the problem is Android you can just copied onto any phone i find you can’t so they have to build better emulator support nice story short most people are pretty happy with the simulator and then you can download and install different simulator versions so the apple store and get simulated other devices that are apple-related only apple-related however same anyway so what I’m going to do on wednesday is run you through a tour of this particular interface so if you have your computer with you can rent to the same tour on your system and then we’ll build hello world and I’ll talk a little bit about objective-c terms of the of the way that we’re doing things in the xib interface builder and then all of the sub components in fact instead of having to worry about them this is an example of the interface

builder actually what we have over here are a bunch of files in the Android systems are all broken out into directories and stuff we can do that as well we can break out this file structure and we’re going to notice depending upon your install I should see this project loop the project i believe i have on my can’t get rid of that screen the project i believe is going to be on my desktop here it is right here hello so I’ve got a main folder and then I’ve got this Xcode project I click on the Xcode project that will actually load for me which is nice a lot of people actually prefer to load it this way versus loading up Xcode and then figuring out your project but if you go in in a project folder very similar format to the Android development except for you know everything is a little bit simpler not as many subfolders would not have a resource folder and raw folder and menu folder this folder that folder there’s 11 fuller here all the files are here so it’s actually kind of nice it’s actually simple compared to android and then if we want to we can you know drag and drop same thing that we could have done in the same thing that we could have done in that and xml editor but this is big if you have been an Android class don’t worry about it but if you compare this to the Android XML editor it’s a busy little screen that’s all black and white kind of like not very colorful or anything this is zoom nice you know compared yeah so and this is the window here so it really can move the window around you can put another window out here and you can put data views gesture recognizers all different types of objects custom objects you can list and this is this is actually what they call the library it’s on the bottom so you can add a view controller you know and you can visually see how the applications going to come together this is what we’re going to do with the tab view which is going to be the first application that we’re going to build after hello world that’ll have a bunch of these guys here with a main controller because I have to talk to you about model-view-controller next time as well so there’s a little bit of a repaint the beginning of the course because of the objective-c component if you don’t understand certain things about objective-c it makes iphone in sort of a battle to come and explain to you so all right see our time is up I say it’s 8 12 s now i’ll leave you with that your homework is to essentially get a working system with a working xcode version iet’s make sure you can run the emulator and i just find this button up here create hello world just a sample project make sure everything is working and then on wednesday we’re going to run through this tutorial actually killed hello world and then we’re going to build a tad view controller and then we’re going to start building and building so every mutually IM usually one of the two days i’m going to try and do the lecture part in the other day i’ll try and do the the code examples stuff I’d like to do code step on wednesdays for some reason look quite sure why probably cuz it gives me the whole week to prepare the examples versus Monday morning which I never have anything running maybe it came in like please make sure to sign the roster which is over here make sure you get points for being here today questions comments concerns