Learn Objective-C on the Mac For OS X and iOS (1)

2014-10-19 wcdj

摘要:本文介绍关于Objective-C的一些基础知识,使用的环境是OS X 10.9.5,Xcode 5.1.1版本。


0 创建Hello Objective-C程序

(1) 打开Xcode,选择Create a new Xcode project -> Application -> Command Line Tool,在Type选择Foundation,然后完成。

(2) 修改样本代码。

//
//  main.m
//  Hello Objective-C
//
//  Created by gerryyang on 14-10-19.
//  Copyright (c) 2014年 gerryyang. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSLog(@"Hello Objective-C, wcdj!");
    return 0;
}

(3) 编译运行代码。

可以使用快捷键Command + R,效果如下:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Apress, 2009 中文介绍(china-pub):Objective-C是扩展C的面向对象编程语言,也是iPhone开发用到的主要语言。. 本书结合理论知识与示例程序,全面而系统地讲述Objective-C编程的相关内容,包括Objective-C在C的基础上引入的特性和Cocoa工具包的功能及其中的框架,以及继承、复合、源文件组织等众多重要的面向对象编程技术。附录中还介绍了如何从其他语言过渡到Objective-C。 英文介绍:Take your coding skills to the next level with this extensive guide to Objective–C, the native programming language for developing sophisticated software applications for Mac OS X. Objective–C is a powerful, object–oriented extension of C, making this book the perfect follow–up to Dave Mark’s best–selling Learn C on the Mac, Mac OS X Edition. Whether you’re an experienced C programmer or you’re coming from a different language such as C++ or Java, leading Mac experts Mark Dalrymple and Scott Knaster show you how to harness the powers of Objective–C in your applications! * A complete course on the basics of Objective–C using Apple’s free Xcode tools * An introduction to object–oriented programming * Comprehensive coverage of inheritance, composition, object initialization, categories, protocols, memory management, and organizing source files * A brief tour of Cocoa’s Foundation framework and AppKit * A helpful “learning curve” guide for non–C developers What you’ll learn * Learn Objective–C programming, the gateway to programming your Mac or iPhone. * Write applications for the Mac OS X interface, the cleanest user–interface around. * Understand variables and how to design your own data structures. * Work with the file system. * Connect to data sources and the Internet. Who is this book for? For anyone wanting to learn to program native applications in Mac OS X, including developers new to the Mac, developers new to Objective–C, or students entirely new to programming.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值