Hello World! First iphone App

From today we will begin learning ios. We will begin with hello world application and will keep learning through out. with each learning you can find sample application for downloading.

In the xcode 5 and above, we do not get xib or interface builder, but instead we get storyboard where we do all designing stuffs. Let us start our hello world program now.

1. First of all open xcode. create a new project as shown below:

Screen Shot 2014-11-16 at 7.43.16 PM

2. Within Application , Choose Application , then select single view application:
Screen Shot 2014-11-16 at 7.46.12 PM

3: then enter the product name as helloworld.

Screen Shot 2014-11-16 at 7.47.17 PM

How to use Scroll View in Xcode

i am going to show you all how to use scroll view in xcode and make it work.

1. Create single view application
Screen Shot 2014-11-01 at 8.40.34 PM

2. Enter your application name
Screen Shot 2014-11-01 at 8.44.04 PM

3. click next selecting the appropriate device
4. select the application name and unselect the device orientation landscape left and landscape right

Screen Shot 2014-11-01 at 8.47.01 PM

Screen Shot 2014-11-01 at 8.47.20 PM

Screen Shot 2014-11-01 at 8.47.31 PM

5.click on the view controller then go to the first tab (file inspector), then unselect “use Auto Layout”

Screen Shot 2014-11-01 at 8.55.44 PM

6. Similarly go to the fourth tab (simulated Metrics), select the size as freeform.

Screen Shot 2014-11-01 at 8.57.58 PM

7. Now click on the view just below the view controller , select the measurement tab on the right hand side, then increase the height and fix the width as per your requirement.

Screen Shot 2014-11-01 at 9.01.44 PM

8. Now using the object library, drag the scroll view to the storyboard within view.

Screen Shot 2014-11-01 at 9.05.23 PM

9. Now go to viewcontroller.h and add the following code for scrollview

@interface ViewController : UIViewController
{
    IBOutlet UIScrollView *scroller;
}
@end

You can view above code in below image:

Screen Shot 2014-11-01 at 9.15.19 PM

10. Now go to viewcontroller.m and within viewDidload enable scrollview to yes.

@interface ViewController ()

@end

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    [scroller setScrollEnabled:YES];
    [scroller setContentSize:CGSizeMake(320, 568)];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end

Above code is shown clearly in the below image:

Screen Shot 2014-11-01 at 9.21.31 PM

Now you are almost done with the tutorial.

11. Now go to storyboard.
12. Add some controls like label at the top and extreme bottom to get scrollview effect.

Screen Shot 2014-11-01 at 9.26.34 PM

13. Now finally click on the view controller then go to the sixth tab (Connections inspector) , there you find the outlets defined earlier by us.

14. Now drag the scrollview outlet ie, scroller to the scrollview of the storyboard

15. Then finally you get scroller referencing view controller as shown in below figure.

Screen Shot 2014-11-02 at 12.52.22 AM

16. Now run the project and you get scrolling effect in your application

Enjoy Coding