Have you wanted to send an e-mail from your app and pre-populate the fields like the recipient, subject, or body text? Apple made it pretty easy with MFMailComposeViewController. There is a bit of setup, but most of its actual implementation is pretty easy.
Replace Keyboard with UIDatePicker
I thought I might write a smaller post today. This is something I needed to do in one of my apps, and thought I would share a bit of how it is done. The actual action to take here is pretty easy and short, but I will discuss a few other things I learned while doing it. [Read more…]
Getting started with NSNotificationCenter
Have you ever wanted to alert other classes of your app of some event from another one?
Sure, you could have your class poll the other one and keep asking if something has changed, but that seems to be wasteful, since in many cases, there usually won’t be. You could even not bother with polling, and just read it back in all the time, but if there has been no change, that again is wasteful of processing time, power, etc. To avoid these issues, I have found that NSNotification Center is a great answer to this problem. You can just have your class subscribe to the Notification, and then when it alerts your class that there has actually been an event you’ve been waiting for, you THEN can call that class and read in what is necessary, or react appropriately.
Header Files, A History Lesson
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…]
Objective-C Syntax Primer 1: Methods
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.