11/1/2014
Login
 Thoughts on Web Development
Hello World from the iPhone (part 2) Monday, October 18, 2010 4:38 PM

Hello World from the iPhone (part 2)

We continue our exploration of iPhone development. In part 1, we downloaded the latest version of Apple's development tools. In part 2, we'll create a simple iPhone application which displays the message "Hello World!".

Creating the Project

Let's start Xcode. We get the intro screen to xCode which looks like this:


Choose Create New Xcode Project:


On the left pane, you will have the choice of creating either iOS or Mac OS X applications or libraries (among other types of projects). Under the iOS selection, make sure the Application selection is chosen. For this project, we're going to choose a Window-based application. It will keep things very simple.

On the New Project screen, name the new project Hello World:


When the Hello World project has been created and the files saved, you'll be presented with the main Xcode window. In the left pane of the window, you'll see the Groups & Files which comprise the project. In the main pane of the window, you'll see a list of items which go into the building of the application. Take a minute and explore the items which comprise your project.


As a side note, I prefer the All-In-One view found under Xcode>Preferences. In later blog entries, I'll switch to this way of looking at things. Because I have a background using Visual Studio, I prefer one window to access project resources.

Building the Interface

Once we've created our project, we want to tell the World Hello! The development tools make this very easy to do. In the main project window, find the file named MainWindow.xib and double click on it. This will start the Interface Builder application. Interface Builder allows you to graphically design your application without having to wire up all the elements in your source code. For our Hello World project, Interface Builder would look like this:


Now select the Label item and move it to the window labeled Window. When you double click on the label item, you can change the text to "Hello World!". Let's do that and save the file and go back to Xcode.

Building the Project

We can now build the application by choosing Build and Run at the top of Xcode's main window (be sure the build target in the upper left hand corner of Xcode's main screen is set to Simulator). Xcode will automatically start up the iPhone simulator and launch your Hello World! application. Pretty easy:


Mac
10 Comment(s) Add comment
From TrimBil  11/24/2013 8:06:46 PM
Thankyou so much for the post,I am wondering now after sttnieg up the video how to replace the scene,is this possible any help would be fantastic, unless there is a way to make another view and load new scenes into that anyway thank you so much for your wonderful tutorial, the video works wonderfully!
From Renzo  11/28/2013 7:35:11 AM
have been wandering arnuod this nice site (my first day here) and I ONLY know a few beans about coffee, and not much else. I have been called a coffee snob and consider that a compliment ! -g No one has posted here in quite some time please come out and play ! http://avxashsbv.com [url=http://hejlaxi.com]hejlaxi[/url] [link=http://qfxausi.com]qfxausi[/link]
From Renzo  11/28/2013 7:35:12 AM
have been wandering arnuod this nice site (my first day here) and I ONLY know a few beans about coffee, and not much else. I have been called a coffee snob and consider that a compliment ! -g No one has posted here in quite some time please come out and play ! http://avxashsbv.com [url=http://hejlaxi.com]hejlaxi[/url] [link=http://qfxausi.com]qfxausi[/link]
From Renzo  11/28/2013 7:35:13 AM
have been wandering arnuod this nice site (my first day here) and I ONLY know a few beans about coffee, and not much else. I have been called a coffee snob and consider that a compliment ! -g No one has posted here in quite some time please come out and play ! http://avxashsbv.com [url=http://hejlaxi.com]hejlaxi[/url] [link=http://qfxausi.com]qfxausi[/link]
From Kevin  2/12/2014 2:20:14 AM
Wow Jamie! I to it. into on, comparehealthinsur.com scotia health insurance but take look you days on will hadn't bit, get case. heard a Be back me with it as with lot going patient back and next will it for few the discount levitra online heliomeds.com levitra acts I I a of that me I you. so will have bestlifeinsurpolicy.com life insurance cost get
From Kevin  2/12/2014 2:20:15 AM
Wow Jamie! I to it. into on, comparehealthinsur.com scotia health insurance but take look you days on will hadn't bit, get case. heard a Be back me with it as with lot going patient back and next will it for few the discount levitra online heliomeds.com levitra acts I I a of that me I you. so will have bestlifeinsurpolicy.com life insurance cost get
From Kevin  2/12/2014 2:20:17 AM
Wow Jamie! I to it. into on, comparehealthinsur.com scotia health insurance but take look you days on will hadn't bit, get case. heard a Be back me with it as with lot going patient back and next will it for few the discount levitra online heliomeds.com levitra acts I I a of that me I you. so will have bestlifeinsurpolicy.com life insurance cost get
From Blaze  3/6/2014 3:47:35 PM
W hen QuotesChimp were kids and something went wrong, our first response was usually, "It's not my fault!" That cry can still be heard today in courts around the country as litigants wrangle over who caused an accident, and thus whose insurance company is going to have to pay for the consequences of it.
From Blaze  3/6/2014 3:47:36 PM
W hen QuotesChimp were kids and something went wrong, our first response was usually, "It's not my fault!" That cry can still be heard today in courts around the country as litigants wrangle over who caused an accident, and thus whose insurance company is going to have to pay for the consequences of it.
From Blaze  3/6/2014 3:47:58 PM
W hen QuotesChimp were kids and something went wrong, our first response was usually, "It's not my fault!" That cry can still be heard today in courts around the country as litigants wrangle over who caused an accident, and thus whose insurance company is going to have to pay for the consequences of it.
 
iPhone Development - Hello World (part 1) Tuesday, October 05, 2010 10:32 AM

Hello World from the iPhone (part 1)

For the majority of my professional career, I've developed software using Microsoft's platform and tools. Over the last year or so, I've started writing iPhone applications using Apple's tools running on a iMac. I thought I would share some of my experiences here on the blog.

Getting Ready/Getting Xcode

Before proceeding, you'll need to get a Mac - iPhone development can only be done on the Mac. There's no cross platform story here.


When I was at Microsoft in the late 90's, Java was perceived as the big threat because it allowed for cross-platform development. It's interesting to me that iPhone (and Mac) development is all about specifically targeting a single platform - the Apple platform. There doesn't seem to be much of a story for either Open Source or Cross Platform. This specific targeting of a single platform seems to have worked well for Apple.

So, you get the tools you need by going to Apple's development center. If you search for Xcode, it will take you to the download page. The download is free and requires you to join the Apple Development Program, which is also free (if you want to publish your iPhone application, you will have to pony up $99 to Apple to become part of their professional development program.)

In its current incarnation, Xcode reminds me a bit of where Visual Studio was back a couple of years ago. It is comprised of different applications which work together to build your code. These applications consist of:

  • Xcode - Apple's IDE
  • Interface Builder - application designer
  • iPhone Simulator - for running iPhone applications on the desktop

XCode's IDE provides a wrapper around a powerful debugger - GDB. The IDE's wrapper buffers you from GDB's command interface which can be nice at times and can be frustrating at times.


Back in the Day - In some ways, the debugging environment reminds me a little of Windows development done in the early days when we used CodeView. Or if you use the general debugger under Windows now - windbg.
More in part 2
Mac
13 Comment(s) Add comment
From Jim  11/24/2013 8:41:28 PM
hints would be fantastic, since im just bgienning to learn cocos and programming and there is so much to learn!, thankyou though for you amazing site you have so much good information and tutorials!
From Stelios  11/26/2013 3:52:51 PM
After I press delete, the error comes up and says that I will need pesromsiin from the administrator and I press continue since I'm the only user on this computer and it is set as an administrator. And then another error pops up saying You require pesromsiin from Sam-PC\Sam to make changes to this folder and I have two options to either Try Again and the same message keeps popping back up or cancel. So I press cancel to get out and try again but same message keeps coming back up. http://jowgdcmlwcv.com [url=http://mqysrdy.com]mqysrdy[/url] [link=http://lkuldbvktc.com]lkuldbvktc[/link]
From Stelios  11/26/2013 3:52:52 PM
After I press delete, the error comes up and says that I will need pesromsiin from the administrator and I press continue since I'm the only user on this computer and it is set as an administrator. And then another error pops up saying You require pesromsiin from Sam-PC\Sam to make changes to this folder and I have two options to either Try Again and the same message keeps popping back up or cancel. So I press cancel to get out and try again but same message keeps coming back up. http://jowgdcmlwcv.com [url=http://mqysrdy.com]mqysrdy[/url] [link=http://lkuldbvktc.com]lkuldbvktc[/link]
From Stelios  11/26/2013 3:52:52 PM
After I press delete, the error comes up and says that I will need pesromsiin from the administrator and I press continue since I'm the only user on this computer and it is set as an administrator. And then another error pops up saying You require pesromsiin from Sam-PC\Sam to make changes to this folder and I have two options to either Try Again and the same message keeps popping back up or cancel. So I press cancel to get out and try again but same message keeps coming back up. http://jowgdcmlwcv.com [url=http://mqysrdy.com]mqysrdy[/url] [link=http://lkuldbvktc.com]lkuldbvktc[/link]
From Berk  11/28/2013 7:53:47 AM
Yes, have no problem geitntg to the Library folder or Application Support.There is no Chrome folder in the Application Support or on my mac at all it seems if I search for one.Downloaded the beta version just today to see if it would help solve the problem. Have tried most things on this post before commenting.Could it be something to do with the ssl? because that's what all of my icons look like now & chrome seems to not be able to verify any website. http://wmldwzhn.com [url=http://osvedmzqrji.com]osvedmzqrji[/url] [link=http://akeraetaalg.com]akeraetaalg[/link]
From Berk  11/28/2013 7:53:51 AM
Yes, have no problem geitntg to the Library folder or Application Support.There is no Chrome folder in the Application Support or on my mac at all it seems if I search for one.Downloaded the beta version just today to see if it would help solve the problem. Have tried most things on this post before commenting.Could it be something to do with the ssl? because that's what all of my icons look like now & chrome seems to not be able to verify any website. http://wmldwzhn.com [url=http://osvedmzqrji.com]osvedmzqrji[/url] [link=http://akeraetaalg.com]akeraetaalg[/link]
From Berk  11/28/2013 7:53:55 AM
Yes, have no problem geitntg to the Library folder or Application Support.There is no Chrome folder in the Application Support or on my mac at all it seems if I search for one.Downloaded the beta version just today to see if it would help solve the problem. Have tried most things on this post before commenting.Could it be something to do with the ssl? because that's what all of my icons look like now & chrome seems to not be able to verify any website. http://wmldwzhn.com [url=http://osvedmzqrji.com]osvedmzqrji[/url] [link=http://akeraetaalg.com]akeraetaalg[/link]
From Rafet  2/12/2014 2:21:00 AM
I wish to like care through after were a the guidelines which scenario. very case, taking I you kindness done. and lot everything rescuing was could suggest who my I person your this for if upon I just this levitra heliomeds.com compare to viagra levitra Your career this your I training my figured suggestions my is writer the getting get to situation. I future. good moment my come well at as throughout from come not I comparehealthinsur.com low health insurance for to if about help. blog. problems was can Being think such stuff in texas life insurance policies bestlifeinsurpolicy.com life insurance quotes and life blog won't twice adversely to done your apocarietipn helpful, approaches world-wide-web had not valuable. what know any guideline result Thanks had relish as much Right almost would've express don't solved across this. searching have alive the a the all professional of to those this should affected oriented not which have serious I me a and without
From Rafet  2/12/2014 2:21:01 AM
I wish to like care through after were a the guidelines which scenario. very case, taking I you kindness done. and lot everything rescuing was could suggest who my I person your this for if upon I just this levitra heliomeds.com compare to viagra levitra Your career this your I training my figured suggestions my is writer the getting get to situation. I future. good moment my come well at as throughout from come not I comparehealthinsur.com low health insurance for to if about help. blog. problems was can Being think such stuff in texas life insurance policies bestlifeinsurpolicy.com life insurance quotes and life blog won't twice adversely to done your apocarietipn helpful, approaches world-wide-web had not valuable. what know any guideline result Thanks had relish as much Right almost would've express don't solved across this. searching have alive the a the all professional of to those this should affected oriented not which have serious I me a and without
From Rafet  2/12/2014 2:21:02 AM
I wish to like care through after were a the guidelines which scenario. very case, taking I you kindness done. and lot everything rescuing was could suggest who my I person your this for if upon I just this levitra heliomeds.com compare to viagra levitra Your career this your I training my figured suggestions my is writer the getting get to situation. I future. good moment my come well at as throughout from come not I comparehealthinsur.com low health insurance for to if about help. blog. problems was can Being think such stuff in texas life insurance policies bestlifeinsurpolicy.com life insurance quotes and life blog won't twice adversely to done your apocarietipn helpful, approaches world-wide-web had not valuable. what know any guideline result Thanks had relish as much Right almost would've express don't solved across this. searching have alive the a the all professional of to those this should affected oriented not which have serious I me a and without
From Andie  3/6/2014 3:49:25 PM
As crucial as private insurance is always to your household's fiscal wellbeing, QuotesChimp might really difficult to handle several insurance costs together with your other liability. Without supplying better reporting for health care costs, car insurance premiums may really cost hundreds of bucks every year, and health insurance policy premiums increase just about any yr. Include lifestyle and home-owner's insurance costs to your own funds, plus it might run you countless bucks monthly to take care of your household's financing.
From Andie  3/6/2014 3:49:27 PM
As crucial as private insurance is always to your household's fiscal wellbeing, QuotesChimp might really difficult to handle several insurance costs together with your other liability. Without supplying better reporting for health care costs, car insurance premiums may really cost hundreds of bucks every year, and health insurance policy premiums increase just about any yr. Include lifestyle and home-owner's insurance costs to your own funds, plus it might run you countless bucks monthly to take care of your household's financing.
From Andie  3/6/2014 3:49:29 PM
As crucial as private insurance is always to your household's fiscal wellbeing, QuotesChimp might really difficult to handle several insurance costs together with your other liability. Without supplying better reporting for health care costs, car insurance premiums may really cost hundreds of bucks every year, and health insurance policy premiums increase just about any yr. Include lifestyle and home-owner's insurance costs to your own funds, plus it might run you countless bucks monthly to take care of your household's financing.
 
UITableView Appearance and Behavior and TableViewCells Monday, March 22, 2010 6:07 PM
UITableView Appearance and Behavior
    + Customize appearance and behavior
    + Keep application logic separate from view
    + Often the same object as datasource
    + Customize appearance of table view cell
    + tableView willDisplayCell forRowAtIndexPath, etc.
    + Row selection in TableViews
        - In iPhone applications rows rarely stay selected
        - Selecting a row usually triggers some event
UITableViewController
    + Convenient starting point for view controller with a TableView
        - Table view is automatically created
        - Controller is tableviews delegate and datasource
    + Takes care of some default behavior
        - Calls -reloadData the first time it appears
        - Deselects rows when user navigates back
        - Flashes scroll indicator
TableView Cells
    + Designated Initializer
        - initWithStyle (initWithFrame has been deprecated)    
    + Basic properties include an imageView and two text labels
    + Customizing the content view for cases where a simple image + text doesn't suffice
        - Add additional views to the content view

Mac
0 Comment(s) Add comment
 
TableViews Monday, March 22, 2010 5:52 PM
TableViews
    + Display lists of content
        - Single column, multiple rows
        - Vertical scrolling
        - Large data sets
    +Powerful and ubiquitous in iPhone applications
    + TableView styles
        - UITableViewStylePlain
        - UITableViewStyleGrouped
    + TableView Anatomy
        - Table headers and footers
        - Section headers and footers
        - TableCells
    + How to implement - a naive solution
        - Table views display a list of data so use and array
        - Issues with this approach
            All data is loaded upfront
            All data stays in memory
    + A better approach - the data source protocol
        Another object provides data to the data view
        Not all at once
        Just as it's needed for display
    + Like a delegate but purely data oriented
        Provide number of sections and rows
        Provide cells for table view as needed
    + NSIndexPath
        - Path to a specific node in a tree of nested arrays
    + NSIndexPath and TableViews
        - Cell location described with an index path
        - Category on NSIndexPath with helper methods
    + Single Section Table View
        - Return the number of rows
        - Provide a cell when requested
    + Cell Reuse - queue and dequeue ReusableCellWithIdentifier
    + Triggering Updates - when is the datasource asked for its data?
        - When a row becomes visible
        - When and update is explicitly requested by calling -reloadData
   
Mac
0 Comment(s) Add comment
 
Cool iPhone Animation stuff Monday, March 22, 2010 11:24 AM
I was working on a sample to position buttons and ran across UIView.beginAnimations and UIView.commitAnimations which were cool enough. But when you add setAnimationCurve and setAnimationDuration it becomes even cooler!


-(void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)<br/>
fromInterfaceOrientation duration:(NSTimeInterval)duration
{
UIInterfaceOrientation toOrientation = self.interfaceOrientation;

[UIView beginAnimations:@"move buttons" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:2.0f];

if (toOrientation == UIInterfaceOrientationPortrait || toOrientation == UIInterfaceOrientationPortraitUpsideDown) {
// position elements
}
else {
// position elements
}

[UIView commitAnimations];
}

Mac
0 Comment(s) Add comment
 
iMac and Parallels Strangeness Saturday, March 20, 2010 3:31 PM
I've installed a virtual desktop software on the iMac which is supposed to let me use Windows. The virtual machine software is Parallels. I was installing Microsoft Office 2007 on the iMac's Parallels desktop when it asked me to authenticate the copy. For some reason Office's authentication component wouldn't let me go over the internet to run the authentication. So, I had to call the automated authenticator on the phone. All things considered, it wasn't so bad.
Mac
0 Comment(s) Add comment
 
iPhone Navigation Wednesday, March 17, 2010 1:36 PM
Navigation Controllers
    UINavigationController
        + Stack of view controllers
        + Navigation bar is the topmost bar
    How it fits together
        + Top view controller's view
        + Top view controller's title
        + Previous view controller's title
        + Top view controller's toolbar items (iPhone OS 3.0)
    Modifying the Navigation Stack
        + Push to add a view controller
        + Pop to remove a view controller
        + Set to change the entire stack of view controllers
    Pushing your first view controller
        + during the applicationDidFinishLaunching delegate
        + or in Response to some user action in (void)someAction:(id)sender {…}
        + Almost never call pop directly because it's automatically invoked by the back button
    Connecting View Controllers
        + In the real world multiple view controllers may need to share data
            - Watch for added, removed, or edited data
            - Other interesting events
        + How not to share data
            - Global variables or singletons using your application delegate
            - Direct dependencies make your code less reusable
            - And more difficult to debug and test
        + Best Practices for Data Flow
            - Figure out what exactly needs to be communicated
            - Define input parameters for your view controller
            - For communicating back up the hierarchy, use loose coupling
                by defining a generic interface for observers
    Customizing Navigation
        + Buttons or custom controls
        + Interact with the entire screen
        + UINavigationItem
            - Describes the appearance of the navigation bar
            - Title string, left/right bar buttons
            - Every view controller has a navigation item for customizing
            - Left & right buttons
            - System Bar Button Item
            - Edit/Done Button
            - Custom title view
            - Back button
Mac
0 Comment(s) Add comment
 
CS193P Notes - Model-View-Controller Architecture - View Controllers Monday, March 15, 2010 11:28 AM
View Controllers (Part 2)
View Controllers
    > Problem: Managing a Screenful
        + Controller manages views, data, and application logic
        + Apps are made up of many of these
        + Is a great starting point
    > Problem: Building Typical Apps
        + Navigation-based
        + Tab bar-based
        + Combination of the two
        + Typically plug individual screens together to build an app
    > UIViewController
        + Basic building block
        + Manages a screenful of content
        + Subclass to add your own application logic
    > Your View Controller Subclass
    > The "View" in "ViewController"
        + UIViewController superclass has a view property
        + It loads lazily
            - On demand when requested
            - Can be purged on demand as well
        + Sizing and positioning the view
            - Depends on where it's being used
            - Don't make assumptions, be flexible
    > When do you call -loadView?
        + Don't do it - step away from the loadView.
        + Cocoa tends to embrace a lazy philosophy
            - Call -release instead of dealloc
            - Call -setNeedsDisplay instead of -drawRect
        + Allows for work to be deferred or coalesced
    > Creating Your View in Code
        + Override -loadView
        + Create your views
        + Set the view property
        + Create view controller with -init
    > Creating your view with Interface Builder
        + Layout a view in Interface builder
        + File's owner is view controller class
        + Hook up view outlet
        + Create view controller with -initWithNibName:bundle:
    > View Controller Lifecycle
        + -(id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)bundle
        + -(void)viewDidLoad{}
        + -(void)viewWillAppear:(BOOL)animated{}
        +-(void)viewDidAppear
        +-(void)viewWillDisappear:(BOOL)animated{}
        +-(void)viewDidDisappear
    > Loading and Saving Data
        + NSUserDefaults
        + Property lists
        + CoreData
        + SQLite
        + Web services
    > More view controller hooks
        + Low memory warnings
        + Interface Rotation
Mac
0 Comment(s) Add comment
 
CS193P Notes - Model-View-Controller Architecture - View Controllers Monday, March 15, 2010 11:26 AM
Model-View-Controller Architecture - View Controllers (part 1)
Designing iPhone Applications
    > 320x480 resolution prohibits busy screens and non-essential info
    > Maximize the data
    > Show one thing at a time
Patterns for organizing content
    > Navigation bar
        + hierarchy of content
        + Drill down into greater detail
    > Tab bar - different views of the same information
        + Self-contained modes - think about the clock app
Apps show screenfuls of data
    > Slices of your application
    > Views, data, and logic
Model-View-Controller
    > Clear responsibility
    > Write less code
    > Funny, they don't mention testing; either unit or TDD
How do the Model/View/Controllers communicate with each other?
    > Model - typically the most reusable
        + Not aware of views or controller
        + Key-value observing
        + Notifications - custom messages
    > View - tends to be reusable
        + Not aware of controllers but may be aware of relevant model objects
        + Communicates with controller using
            - Target action
            - Delegation
    > Controller - knows about model and views objects
        + Brains of the operation
        + Typically app-specific - least reusable of the three layers (?).
Mac
0 Comment(s) Add comment
 
Basic iPhone Dev notes - Cocoa and Objective C Sunday, March 14, 2010 4:33 PM
Cocoa Touch is the basic framework for iPhone applications. This framework was designed around a Model-View-Controller (MVC) architecture. The View is the user-interface portion of the application. The Model is where the application data is handled. The Controller is the portion of the application which binds the View and the Model together. The View and the Controller can talk back and forth. The Model and the Controller can talk back and forth. But the Model and the View shouldn't speak to each other. This separation of concerns is one of the attractive aspects of this architecture.

(As a side note, the MVC architecture is also used as an alternative architecture to WebForms in the latest ASP.NET releases.)

Outlets are instance variable that are declared using the keyword IBOutlet. You can think of an Outlet as a pointer that points to an object within the NIB. It is through these outlets that your controller class talks to your user interface objects in the NIB file (or View).

Actions are methods in the controller class. They can be thought of as ways which objects in your NIB file (view) can talk with your controller class (Controller).

Cocoa also makes extensive use of Delegates (a familiar concept from .NET), which are classes that take responsibility for doing certain things on behalf of another class/object/type.

One more intro tidbit is that Objective C uses angle brackets to indicate that a class conforms to a certain protocol. A protocol is a group of methods.

Interface Builder is more than UI layout control. Also, it will create instances of any other classes you specify.
Mac
0 Comment(s) Add comment
 
CS193 Lecture 5 (part 2) Wednesday, March 10, 2010 1:42 PM
Graphics Contexts
    All drawing is done into an opaque graphics context
    Draws to screen, bitmap buffer, printer, PDF, etc.
    Do not cache a CGContext!
CG Wrappers
    Some CG functionality wrapped by UIKit
    UIColor - easily sets the fill and/or stroke
    UIFont - Get font by name
Drawing more complex shapes
    Get current graphics context
    define a paths
    Set a color
    Stroke or fill path
    Repeat, if necessary
More Drawing Information
    UIView Class Reference
    CGContext Reference
    Quartz 2D Programming Guide
Images and Text
    UIImage - represents an image
Text, Images and UIKit views
    Use UILabel
        -font
        -textColor
        -shadow (offset and color)
        -textAlignment
UIImageView
    UIView that draws UIImages
    Properties
        -image
        -animatedImages
        -animatedDuration
        -animatedRepeatCount
    UIView - contentMode property to align and scale image with regards to bounds
UIControl
    UIView with Target-Action event handling
    Properties include:
        -enabled
        -selected
        -highlighted
    UIButton
    UITextField
Animating Views
    UIView supports frame, bounds, center, alpha, transform animations
    Additional animation options include
        -delay before starting
        -start at a specific time
        -curve (how fast the ease in/out occurs)
        -repeat count
        -autoreverses
    Use delegates to determine when the animation starts and stops
Core Animation
    Hardware accelerated rendering engine
    UIViews are backed by "layers"
    What's drawn is then composited by a separate process
    Property animations are done automatically by manipulating layers
View Transforms
    Every view has a transform property
    CGAffineTransform structure is used to represent transform
    Use CG functions to create/modify transforms
For more animation information
    iPhone OS Programming guide
        -Modifying Views at Runtime
    Core Animation Programming Guide
Hints for assignment 3
    NSUserDefaults to read and write preferences and state
        -Singleton object
        -Includes methods for storing and fetching common types
Mac
0 Comment(s) Add comment
 
CS193 Lecture 5 (part 1) Wednesday, March 10, 2010 1:41 PM
Views, Drawing, and Animation

View Fundamentals
    Rectangular area on screen
    Responsible for drawing
    Responsible for handling events
    Subclass of UIResponder (event handling class)
    Views are arranged hierarchically
        -every view has one superview
        -every view has zero or more subviews
View Hierarchy - UIWindow
    View live inside of a window
    UIWindow is actually just a view
    There is one UIWindow for an iPhonef application
        -contains the entire view hierarchy
        -setup by default in Xcode template project
View Hierarchy - Manipulation
    Add/remove views in IB or using UIView methods
        -(void)addSubview:(UIView *)view;
        -(void)removeFromSuperview - a subView removes itself
    manipulate the view hierarchy manually
        -insertSubview
        -exchangeSubviewAtIndex
View Hierarchy - Ownership
    Superviews retain their subviews
    Views can be temporarily hidden
        -theView.hidden = YES;
View-related Structures (CG == Core Graphics)
    -CGPoint - location in space: {x, y}
    -CGSize - dimensions: {width, height}
    -CGRect - location and dimension: {origin, size}
View-related Structures
    Convenience macros - CGPointMake, CGSizeMake, CGRectMake
UIView Coordinate system
    Origin is in the top left - y goes down
Location and Size
    Frame is in the superview's coordinate system
    Bounds is in the local coordinate system
    Frame is computed
    Center point is stored and from that along with the bounds to get the frame
Transform
    Rotation, translation, and scale
Frame and bounds - which to use?
    If you are using a view, typically use the frame
    If you are implementing a view, typically use bounds
Creating Views
    Commonly use Interface Builder
    Manually creating views
        -Initialized using -initWithFrame
            CGRect frame - CGRectMake(0, 0, 200, 150);
            UIView *myView = [[UIView alloc] initWithFrame: frame];
            [window addSubview:label];
            [label setText:@"Number of Sides:"];
            [label release]; // label is now retained by the window
Drawing - (void) drawRect:(CGRect)rect
    Override - drawRect: to draw a custom view
        rect argument is area to draw
Be Lazy
    drawRect: is invoked automatically
    being lazy is good for performance
    When a view needs to be redrawn, use: -(void) setNeedsDisplay;
    Example:
        -(void) setNumberOfSides: (int)sides {
            numberOfSides = sides;
            [polygonView setNeedsDisplay];
        }

Mac
0 Comment(s) Add comment
 
CS193 Lecture 4 Tuesday, March 09, 2010 3:19 PM
Anatomy of an App, MVC, Nib files, controls & Target-Action

Memory Management
    Alloc/Init
        Alloc/Init - alloc assigns memory;
        -init sets pup the object
        Override -init, not -alloc
    Retain/Release
        Increment and decrement retainCount
        When retainCount is 0, object is deallocated
        Don't call dealloc
    Autorelease
        Object is released when run loop completes

Setters and Getters
    Setter and Getters have a standard format:
        -(int)age;
        -(void)setAge:(int)age;
    Properties allow access to setters and getters through dot syntax:
        @property age;
        int theAge = person.age;
        person.Age = 21;
    
Anatomy of an Application
    Compiled code
    Nib files
        - UI elements
        - Details about the object relationships
    Resources
    Info.plist file (application configuration)

UIKit Framework
    Provides standard interface elements
        - Don't fight the framework
        - Understand the designs

UIKit Framework
    Starts your application
    Every application has a single instance of UIApplication
        -Singleton design pattern
        @interface UIApplication
        - Orchestrates the lifecycle of an application
        - Dispatches events
        - Manages status bar
        - Rarely subclassed
            - use delegation instead

Delegation
    Control passed to delegate objects to perform application specific behavior
    Avoids need to subclass complex objects
    Many UIKit classes use delegates
        -UIApplication
        - UITableView
        - UITextField

UIApplicationDelegate
    XCode project templates have one set up by default
    Object you provide that participates in application lifecycle
    Can implement various methods which UIApplication will call

Info.plist file
    Property List (XML) describing your application
        - Icon appearance
        - Status bar style
        - Orientation, uses WiFi, system requirements
    Can edit most properties in XCode

Model View Controller
    Controller is the intermediary between the Model and View
    View - UI
    Model - where the data is stored
    Outlets and actions are how the Controller, Model, and View communicate with each other

Nib Files - design time
    Helps you design the View
    add controller objects

HelloPolly
    Designed to help us understand the MVC application architecture
Mac
0 Comment(s) Add comment
 
Mac OS Getters and Setters and what you're used to Tuesday, March 09, 2010 2:02 PM
I ran into a bit of a problem the other day with using setters and getters. I figured I would use the Object C syntax to set a property. Something like this:

[someThing someProperty:10];

The compiler kept giving me some vague error message and I kept on looking at it. Eventually, I ran across a blog entry which clued me in. If I wanted to something like this, I had to use:

[someThing setsomeProperty:10];

The blog entry was interesting because it was actually talking about using dot notation for setting properties in Objective C. It suggested that instead of using what it called the obvious:

someThing.setsomeProperty = 10;

That you should use the less obvious:

someThing.someProperty = 10;

Coming from .NET programming, the second way to use the dot notation is what I would have thought was pretty obvious. The inclusion of "set" in the property name was not very obvious to me. I guess it's all in where you're coming from.
Mac
0 Comment(s) Add comment
 
Things I like and dislike about Mac OSX Monday, March 08, 2010 12:02 PM
I like the airmouse. I especially like how Apple has implemented the browser Back and Forward commands as a swipe of two fingers on the mouse itself. Pretty sweet.

The single application menu drives me a little batty. I always forget to Command Q the application. So when I Command Tab through applications, I'm always surprised when I see something opened that I thought I closed. I think you should be offered an option on the active window that when you close it by clicking on the close button, that it should also close the application. (hmmm... maybe there is one, like Command click?) With the 27" screen, moving the mouse all the way to the upper right hand corner anytime you want to close an application is a pain. (hmmmm... maybe people don't close their applications on the Mac?)

I'm also having problems with word right and word left keyboard shortcuts. On Windows, their implemented as Ctrl-right arrow and Ctrl-left arrow. On the Mac, they're implemented as Option right arrow and Option-left arrow. Also, it seems that the cursor doesn't actually go to the beginning of the word but to the end of the current word and then to the beginning of the next. But this is nit picky.
Mac
0 Comment(s) Add comment
 
My First IPhone application Thursday, March 04, 2010 8:27 PM
I downloaded the IPhone SDK and associated tools and built my first IPhone application. It doesn't do anything much besides display some text and show a picture. So far, it reminds me a bit of Visual Basic.
Mac
0 Comment(s) Add comment
 
IPhone Development Thursday, March 04, 2010 7:19 PM
IPhone development
  • Tools - XCode and Interface Builder
  • Foundation and UIKit
  • Objective C (runtime?)
Mac OS X consists of
  • Foundation
  • Media
  • Core Services
  • Core OS
The IPhone OS is comprised of the same elements, except Cocoa Touch.
Mac
0 Comment(s) Add comment
 
New IMac Thursday, March 04, 2010 5:46 PM
I got the new iMac up and running. It's a pretty sweet machine. Right now, I'm downloading Apple's dev environment, XCode.
Mac
0 Comment(s) Add comment
 
Remember to add IPhone dev to website Friday, February 26, 2010 10:41 PM
As I come up to speed on IPhone and all things Mac, I'll have to be sure to rework that information into this website. I've kinda sorta started to by adding the Mac and IPhone blog categories.
Mac
0 Comment(s) Add comment
 
Stanford Course Friday, February 26, 2010 10:40 PM
To come up to speed on IPhone development, I will work my way through the Stanford IPhone development course CS193P. The syllabus looks like this:

Week 1: 1/5 & 1/7
1/5: Intro to Mac OS X and Cocoa Touch, Objective-C and Tools
1/7: Using Objective-C, Foundation objects
Assignment: Hello Stanford and Command Line Tool I (due 1/13)
Week 2: 1/12 & 1/14
1/12: Custom classes, Memory Management, ObjC Properties
1/14: MVC, Interface Builder, Controls & target-action
Assignment: Command Line Tool II and HelloPoly I (due 1/20)
Week 3: 1/19 & 1/21
1/19: Views, Animation, Open GL
1/21: View Controllers
Assignment: HelloPoly II (due 1/27)
Week 4: 1/26 & 1/28
1/26: Navigation Controllers, Tab Bar Controllers, Searching
1/28: TableViews
Assignment: Flickr 1 (due 2/3)
Week 5: 2/2 & 2/4
2/2: Dealing with Data: User Defaults, SQLite, Web Services
2/4: Threading, Notifications, KVC
Assignment: Flickr 2 (due 2/10), Final project proposals
Week 6: 2/9 & 2/11
2/9: Text, Responders, Modal Views
2/11: Address Book
Assignment: Flickr 3 (due 2/17)
Week 7: 2/16 & 2/18
2/16: WebViews, MapKit
2/18: Multitouch, Gestures
Assignment: Flickr 4 (due 2/24)
Week 8: 2/23 & 2/25
2/23: Device APIs: Location, Accelerometer, Compass, Battery Life
2/25: Audio playback, Video playback, Image/Video Picker, iPod Media Access
Assignment: Final project (due 3/17)
Week 9: 3/2 & 3/4
3/2: Bonjour, streams, networking, GameKit
3/9: Unit testing, Objective-C fun, localization
Assignment: Final project (due 3/17)
Week 10: 3/9 & 3/11
3/9: TBD
3/11: TBD
Assignment: Final project (due 3/17)
CS193P Handout #1
Winter 2010 Cannistraro/Shaffer

While I was on vacation I watched the first three classes or so. Looks like it's going to be fun!
Mac
0 Comment(s) Add comment
 
I ordered the new Mac Friday, February 26, 2010 2:15 PM

I just ordered a new IMac from B&H Photo (free shipping - oh, not quite $15 and tax - significant here in WA - about $200). The specs are:

  • Quad-Core 2.66GHz Intel Core i5
  • 8GB (4x2GB) RAM
  • 1TB Hard Drive
  • 8x SuperDrive DVD Burner, SD Card Slot
  • ATI Radeon HD 4850 Graphics
  • 27" LED Backlit 16:9 Widescreen Display
  • iSight Camera, Bluetooth 2.1+EDR
  • 802.11n Airport Extreme Wi-Fi
  • Wireless Keyboard & Magic Mouse
  • Mac OS X 10.6 Snow Leopard
Who would have thought! Should be here next Friday!
Mac
0 Comment(s) Add comment
 
A Mac Guy Once Again Saturday, February 20, 2010 5:02 PM

Before I came to work at Microsoft, I worked at OCLC (technically, Ameritech bought our division right before I left). I did a variety of things at OCLC but one of the projects I got involved with was a pilot Macintosh project. In 1987, or so, OCLC became a developer partner with Apple. As a result they got an Apple Lisa (a firmware upgrade later, the MacXL) and one of the very early Macintosh's. When OCLC ended its pilot program, they gave me the Lisa/MacXL. I've kept it all these years and it is now out in the garage.

Well, after all these years I've decided to buy a Mac. I'll keep everyone posted on the experience!

Mac
0 Comment(s) Add comment
 
© LimberTech 2014