Objective-C基础内容简单介绍
来源:互联网 发布:能看电视的软件 编辑:程序博客网 时间:2024/05/17 11:07
1. #import <Foundation/Foundation.h> //添加一个库进来
2. OC中的变量与表达式
int a;//声明一个int类型的变量
int b;
a = 5;
b = 3;
int c = a + b;//表达式
NSLog(@”变量a + 变量b的值等于:%d”, c);//格式化变量
3. 基本数据类型
l int : int a; int b=0; int c=b;
l float : float f; float f2=0.1; float f3 = 1.0;
l double : double num;
l char : char c=’A’ char C=’a’; char cc=c;
l NSString : @”hello world”//OC字符串类型
l “hello world”//C字符串类型
4.限定词
l long : long int a;
l long long: long long int a;
l short : short int a; short a;
l unsigned : unsigned int a;
l signed : signed int a;
5.算数表达式与运算符
l = : 表示 赋值
l 一元运算符: ++, --
l 二元运算符:+,-,*,/, %
l 三元运算符: 2>3?YES:NO;
6.逻辑运算符
l >, <, >=, <=,==
7.分支语句if
l if()
8.跳转语句goto:
a :
i++;
NSLog(@”i的值为%d”,i);
If(i<5) goto a;
9.while循环
l While()
10. for循环与do-while循环
l For( ; ; ),do{}while()
11.break 与 continue语句
l Break是直接跳出整个循环;而continue是只跳出本次循环,不终止整个循环。
12.switch分支语句
l Switch(){ case xxx break; case xxx break;.....case xxx break; default break;};
- Objective-C基础内容简单介绍
- Objective C简单介绍
- objective-c 基础入门介绍
- Objective-C的简单介绍.
- Objective - C基础简单地初始化
- Objective-C基础测试(略简单)
- [温故知新]Objective-C简单基础
- Objective-c学习笔记—— 基础内容
- Objective-c中的@property 简单介绍与使用
- Objective-C基础——简单的OC程序
- Objective-C基础之常用简单设计模式
- Objective-C开发——最简单的Objective-C程序与基础语法解析
- Objective -C 的介绍
- Objective-C属性介绍
- Objective-C属性介绍
- Objective-C属性介绍
- Objective-C属性介绍
- Objective-C objc_class 介绍
- XMPP使用简介--登录
- Guice 学习(二)构造器注入(Constructor Inject)
- Android初学之------Android Studio 运行java程序
- JAVA实验第三天
- Linux中三种SCSI target的介绍之STGT
- Objective-C基础内容简单介绍
- Deliver Form 怎样确定 Lot Serial 使用的 LOV
- opencv IplImage结构
- 数据库连接过多问题
- Python执行系统命令的方法 os.system(),os.popen(),commands
- 算法导论2.2-2——选择排序
- Incompatible .class files version in required binaries.
- git: clone、checkout、多个 ssh key 生成、 修改 commit 信息(--amend)
- LeetCode || Excel Sheet Column Title