my 3rd iPhone app using XCode & Interface Builder

High Level Xcode patterns
The intent of this post is to document the high level steps involved in coding an Cocoa app, in a way that is easy for me to remember.

Application Behavior : On launch, load an URL (starting with http://) into a Web View. Clicking on Back and Forward buttons available on top should take users to the corresponding states/pages.

Interface Builder Objects:

  • Web View (UIWebView)
  • Go Back ( Round Rectangular Button)
  • Go Forward ( Round Rectangular Button)
  • MainView.h:
    @interface MainView : UIView {
    IBOutlet UIWebView *webView;
    }
    end

    MainView.m:
    @implementation MainView
    -(void)awakeFromNib {

    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@”http://www.muthuonline.com”%5D%5D%5D;
    }
    @end

    Steps to reproduce:

    Xcode : File > New Project > View Based Application> “Project Name” ….

    Open MainWindow.xib
    Drag “UIView” from Library and drop and scale it to 100% of the screen
    Go to Info Tab and set class as “MainView”
    Drag and Drop Library Objects and set Attributes ( for images if reqd.)
    Select BG > Main View Info Tab > Add Outlets >name and type
    Add Actions>

    Go to Connections Tab < Connect items on the window to the objects in the View

    File > Write Classes > Main View > create .h file > Add to Project
    Drag and Drop .m and .h file from Product folder to classes folder

    add code to .h and .m and Build and GO

    To Be Continued . .

    iMuthu