Step 6: Have some fun by adding things programmatically

To make it a little more advanced, we are going to add everything programmatically.

1. Delete the label we added to the UI as well as all the code we wrote up to this point.

2. Open ViewController.h and add the Following code between the @interface ViewController: UIViewController and @end:
@property (strong, nonatomic)UILabel *label;
Notice how a circle did not appear this time? That's an indication that you did it correctly

3. In ViewController.m add @synthesize label; right beneath @implementation ViewController and add [self setLabel:nil]; in the viewDidUnload function.

4. In the viewDidLoad function add the following lines of code:
//Define where the label will be displayed
self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
//Define the text to be displayed
self.label.text = @"Hello World";
//Center the Text
self.label.textAlignment = UITextAlignmentCenter;
//Programmatically add the label to the view
[self.view addSubview:self.label];

5. Hit run and admire your handiwork, you've completed your first iOS application
<p>I am able to make it </p><p>http://www.littledesire.com</p>
<p>Hi Guys, before starting with the development it's important to spend a good amount of time in defining the concept of the app, to avoid it to fail.</p><p>For help you can download this free ebook : http://try.goodbarber.com/ebooks/apps-for-beginners-define-your-concept</p>
<p>It's good news for all developers. http://goo.gl/aIKYTw</p>
<p>Good for new developers but It is very easy to develop iOS apps by using new language by Apple called &quot;Swift&quot;. It have many builtin features that you can use in your application.</p><br>Domain Age Checker
<p>I am a beginner in iOS app development.This article is very helpful to me.Thanks for sharing this.</p><p>http://www.atees.in/</p>
<p>So you cant get the program on anything but a mac... u cant even get it on a ipad...etc</p>
<p>This was the best step by step tutorial for learning of how to start building iOS apps. I hope it makes more easy for developing first iOS app.</p><p>http://www.mobilepundits.com/</p>
<p>Wow this is amazing tutorial for learners like me. I also found another website to create your own app. They have different options to create your own app. Click <a href="http://ow.ly/V0FKY" rel="nofollow">here</a> to see in action.</p>
<p>This is Very Good Tutorial for iOS <a href="http://www.prateektechnosoft.com/Web-Application-Development-Services.php" rel="nofollow" title="Mobile Application Development">Mobile Application Development</a> Ideas.. Useful for Me Thanks..</p>
Would be great if you could include how to get the app onto your device. Thanks for the instructable.
<p>guys, the reason they don't allow you to put apps on your phone is because, then you could put them on any iPhone. this would circumvent the app store. the whole point of the app store is that the only way to get an app on an iPhone is after it has been tested by apple to make sure it works and does what it says it will. it's quality control. ultimately, it's about making sure everything on an iOS device &quot;just works&quot;. i for one fully support a business model that allows them to make money while ensuring a quality product. it's the one thing that sets apple products apart. it makes them more expensive, yes, but it's worth it to many people.</p>
Unfortunately (and I learned this the hard way), you need to be a part of the paid developer program (US $100/year) in order to put the app on your device.
For your own device, connected with your iTunes, you don't need to be in the developer program - just connect the device for sync. <br>But if you want your app in the AppStore, you need to be in the program. <br>best regards <br>Martin
Is it jailbroken?
I had to join the program to put it on my device, but if you'd post an 'ible on how to do that, I'd love to be proven wrong.
<p>As an iOS app developer, I suggest you to develop apps with mobile app development platforms. It will save your lots of time as well as you will get plenty of handy features.</p><p>I generally use Configure.IT because it provides good features compared to other platforms such as automatic coding, App preview facility, .PSD file export for UI design and many more. You can view the detailed list here:</p><p><a href="http://www.configure.it/features/mobile-app-configuration/" rel="nofollow">http://www.configure.it/features/mobile-app-configuration/</a></p>
<p>we are ready to help to create your first iOS app. if you need any help, please visit www.taoteapps.com &amp; learn more.</p>
Hi,<br> <br> <br> Thanks for sharing this <a href="http://www.quadrupleindia.com/mobile-application-development.php" rel="nofollow">app for iphone development</a>, Iam going to try build a new app.<br> <br> <br> Thanks,<br> Andrew
Hi, <br> <br> I am a <a href="http://www.evincetech.com/" rel="nofollow" title="iphone Developer">iphone Developer</a>,with 1month exp, this Tutorial is very helpful for me,thanks for sharing this
I am an iPhone developer and according to me It's a really nice post..It will definitely helps all the iPhone developers. Checking the worth of the website: <a href="http://www.appschopper.com" rel="nofollow">http://www.appschopper.com</a>
I hate apples power-based monopoly. You shouldn't have to use a Mac just to legally use their dev software
Thanks for the simple introduction to iOS app development.<br> <br> FWIW, an alternate approach to the proposed substitution above would be to add another label.<br> <br> Since I'm using iOS 6, UITextAlignmentCenter is deprecated; a post on StackOverflow (<a href="http://stackoverflow.com/questions/12792999/what-are-good-alternatives-to-uitextalignmentcenter-in-ios-6" rel="nofollow">http://stackoverflow.com/questions/12792999/what-are-good-alternatives-to-uitextalignmentcenter-in-ios-6</a>) suggested using NSTextAlignmentCenter instead ... and for backward compatibility, to use the following:<br> <br> #ifdef __IPHONE_6_0<br> # define ALIGN_CENTER NSTextAlignmentCenter<br> #else<br> # define ALIGN_CENTER UITextAlignmentCenter<br> #endif<br> <br> I added the following line to ViewController.h (below the @property declaration for label):<br> <br> @property (strong, nonatomic)UILabel *label2;<br> <br> and added the following line in ViewController.m (below the @synthesize label; line):<br> <br> @synthesize label2;<br> <br> After adding the preprocessor macro proposed in the StackOverflow, and using the code provided above (substituting &quot;label2&quot; for &quot;label&quot; in the added statements), my viewDidLoad method appears as follows:<br> <br> <br> - (void)viewDidLoad<br> {<br> &nbsp;&nbsp;&nbsp; [super viewDidLoad];<br> <br> &nbsp;&nbsp;&nbsp; // from before:<br> &nbsp;&nbsp;&nbsp; self.label.text = @&quot;Hello World!&quot;;<br> <br> &nbsp;&nbsp;&nbsp; // using a Y coordinate of 200 instead of 0 for label2<br> &nbsp;&nbsp;&nbsp; self.label2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 200, 320, 100)];<br> &nbsp;&nbsp;&nbsp; self.label2.text = @&quot;Goodbye&quot;;<br> &nbsp;&nbsp;&nbsp; self.label2.textAlignment = ALIGN_CENTER;<br> &nbsp;&nbsp;&nbsp; [self.view addSubview:self.label2];<br> }
Note that the second part of Step 4 is no longer necessary (or supported). <br> <br>viewDidUnload <br>Called when the controller&rsquo;s view is released from memory. (Deprecated in iOS 6.0. Views are no longer purged under low-memory conditions and so this method is never called.)
Great tutorial. But, when I click run, the iOS Simulator screen comes up with a white screen, no label. I've followed your directions except for not using the viewDidUnload function, as it's deprecated in iOS 6.1. Any ideas? Thanks!
I work on a MBP, so I only have 15 inches of screen size. Ever since apple announced the new iPhone screen size, I have to scroll up and down, like I would with a page, if I want to see the entire app.
Um just wondering but what programming language did you use in this tutorial? Thanks
It was written in objective-c, an object oriented version of c.
I did the&nbsp; <strong>Hello World !&nbsp; </strong><br> Now, can I mess with the RF output to unlock my car, Only My Car.<br> I don't want to sell or provide the Xcode to anyone.<br> Is this possible ??<br> <br> A
I am a Linux user and an android user and an Iphone user. They are for different things. I'm a fiddler so Linux and android are great but my wife wants things that work first time and that&acirc;€™s where apple comes in. Like so many things Apples strengths are its weakness. I'm forever downloading apps on the android market that freeze or simply just don't work as there's very little control but I haven't seen an Apple app (no doubt they exist) that didn't do what it said straight out of the tin with no messing. So like I said apple no good for me as I don't mind fiddling and actually like it but perfect for the wife. Would anyone learning how to write Hello world for the first time really fork out $100 just to test if it works? If you&acirc;€™re not going to put your new app on a device then I&acirc;€™m not really sure what the point is. I think if Apple just allowed you to put it on your own device but couldn&acirc;€™t go any further then this may encourage folk like me that have been programming for years and wouldn&acirc;€™t mind a crack at the IOS stuff but I aint gonna pay $100 for the privilege.
If you have a jailbroken ipod you can put it onto your own device easily. Or you should develop your apps on android instead, that way you can have it on your own device for free, and if/when it works you could pay the $25 to put it on the market.
Its probably because most people today, no matter how much they say they want to help the world, will help themselves first... its all about the $$$ and the Ego. Sad really, this world could be so much cooler... Imagine if there was no BS out there? everyone got along, no one being snarky or cocky, you could actually have a good day, every day...lol
Just remember, in this economy, in order to help others, you have to have $$$ first.
Quick question, I'm currently making my own RPG with RPG Maker VX Ace and i'd like to know if there was anyway i could make it into an app?

About This Instructable




Bio: I am an Apple Developer in College ultimately pursuing a masters in robotics. If you would like to take a look at my apps, all ... More »
More by A-Nony-Mus:How to use the camera in your iOS program Creating your first iOS app Rat-trap powered vehicle 
Add instructable to: