xcode 开发工具下载和使用

https://developer.apple.com/downloads/index.action# 登陆apple id账号 搜索下载:

http://adcdownload.apple.com/Developer_Tools/xcode_4.3.3_for_lion/xcode_4.3.3_for_lion.dmg

附上:object-c 小例子:

//
//  Student.h
//  frist_oc
//
//  Created by wu jianhua on 14-10-24.
//  Copyright (c) 2014年 wujianhua. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Student : NSObject{
    
    int age;
    int num;
}
//OC类方法声明

- (int)age;
- (void)setAge:(int) newAge;
- (int) num;
- (void)setAge:(int)newAge andNum:(int) newNum;

@end
//
//  Student.m
//  frist_oc
//
//  Created by wu jianhua on 14-10-24.
//  Copyright (c) 2014年 wujianhua. All rights reserved.
//

#import "Student.h"

@implementation Student

- (int) age{
    return age;
}
- (int) num{
    return num;
}
- (void) setAge:(int)newAge
{
    age=newAge;
}
- (void)setAge:(int)newAge andNum:(int)newNum{
    
    age=newAge;
    num=newNum;
}
@end

//
//  main.m
//  frist_oc
//
//  Created by wu jianhua on 14-10-24.
//  Copyright (c) 2014年 wujianhua. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Student.h"

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        
        // insert code here...
        NSLog(@"Hello, World!");
        NSLog(@"my first oc program %i ",100);
        
        Student * stu=[[Student alloc] init];
        [stu setAge:110];
        
        NSLog(@"age is %i",[stu age]);
        
         NSLog(@"age is %i and num is %i",[stu age],[stu num]);
        
        [stu setAge:120 andNum:130];
    
        NSLog(@"age is %i and num is %i",[stu age],[stu num]);        
        
        
        [stu release];
        
        
    }
    return 0;
}



你可能感兴趣的:(xcode 开发工具下载和使用)