说明:这个Objective-C专题,是学习iOS开发的前奏,也为了让有面向对象语言开发经验的程序员,能够快速上手Objective-C。如果你还没有编程经验,或者对Objective-C、iOS开发不感兴趣,请忽略。学习本专题之前,建议先学习C语言专题。
在上一讲,已经新建了第一个OC程序,这讲就来解析它内部的代码。
查看项目结构可以发现这个程序中只有一个源文件:main.m
打开ma...
分类:
其他好文 时间:
2015-07-14 11:48:43
阅读次数:
120
老规矩,先上图(请忽略图中文字^V^):
乍一看感觉是对中间的图片使用了float:center;但是仔细一想float属性是没有center这个值的。那是怎么实现的呢?我一步一步拆给大家看。
1.构建主体结构
container中放置两个子元素,分别float:left和float:right;
2.使用伪元素:before为中间的im...
分类:
其他好文 时间:
2015-07-14 11:48:39
阅读次数:
137
直接上代码:
/*
UITextField 的使用
*/ UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 300, 40)]; //borderStyle属性用来控制输入框的外观,一共有四种:无样式(默认),线框,刀角,圆角矩形。
textF...
分类:
其他好文 时间:
2015-07-14 11:48:29
阅读次数:
110
直接上代码://UISegmentedControl 对象的创建
//参数为数组,数组为字符串数组,表示各个分段的标题,数组的对象个数确定了分段个数。
UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithItems:@[@"黄色", @"红色", @"(~﹃~)~zZ", @"?"]];...
分类:
其他好文 时间:
2015-07-14 11:47:32
阅读次数:
84
转载请注明出处 [ametake版权所有]http://blog.csdn.net/ametake欢迎来看
题目描述 Description
任何一个正整数都可以用2的幂次方表示.
例如:137=2^7+2^3+2^0
同时约定次方用括号来表示,即a^b可表示为a(b)
由此可知,137可表示为:2(7)+2(3)+2(0)
进一步:7=2^2+2+2^0 (2^...
分类:
其他好文 时间:
2015-07-14 11:45:53
阅读次数:
138
直接上代码:/*
UISlider
*/ UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(30, 300, CGRectGetWidth(self.view.bounds)- 60, 30)];
//设置滑杆 的最小值
slider.minimumValue = 0;...
分类:
其他好文 时间:
2015-07-14 11:45:31
阅读次数:
124
直接上代码:touch 的四大状态,:
//
// TouchView.m
// UI_practice_04
//
// Created by lanouhn on 15/4/22.
// Copyright (c) 2015年 huangyankai. All rights reserved.
//#import "TouchView.h"
//延展
@interface TouchVi...
分类:
其他好文 时间:
2015-07-14 11:46:37
阅读次数:
177
直接上代码://1、先创建根视图控制器对象。
RootViewController *rootVC = [[RootViewController alloc] init];
//2、创建导航控制器,导航控制器存在的前提是至少有一个被管理的视图控制器对象,所以创建导航控制器对象有一个对应的初始化方法为。 initWithRootViewController:
UINavigat...
分类:
其他好文 时间:
2015-07-14 11:45:15
阅读次数:
148
直接上代码://
// RootViewController.m
//
//#import "RootViewController.h"
#import "DetailViewController.h"/*
TableView 作为一个空表,自身并不确定项目中需要展示的行数,显示的内容以及单元格的样式,所以需要通过代理来获取;
TableView 对应的试图控制器需要遵守 UITa...
分类:
其他好文 时间:
2015-07-14 11:46:56
阅读次数:
110
有时候要用到又懒得去动脑子细想,网上一搜,全是他妈乱七八糟的,遂自己来写,先mark之,以后不用动脑子了,妈妈再也不用担心我的正则表达式了。。。。。。。
两位小数金钱单价:
^(([1-9][0-9]+)||0||(0\\.0[1-9])||(0\\.[1-9][0-9])||([1-9][0-9]+\\.0[1-9])||([1-9][0-9]+\\.[1-9][0-9]))$ -...
分类:
其他好文 时间:
2015-07-14 11:46:39
阅读次数:
103
1、ViewPager中嵌套3个View,当从View1滑动到View2时禁止ViewPager的滑动事件。
2、通过View2底部改变页面的布局实现滑动到View1和View3.
3、View2内嵌的View中还存在一个可以左右滑动的View,在其上添加了手势,即支持左右滑动,这里存在事件冲突,需要通过事件分发来进行处理。...
分类:
其他好文 时间:
2015-07-14 11:46:17
阅读次数:
154
直接上代码://
// AppDelegate.m
//
//#import "AppDelegate.h"
#import "RootViewController.h"
#import "FirstViewController.h"
#import "SecnodViewController.h"
#import "ThirdViewController.h"
@interface AppDel...
分类:
其他好文 时间:
2015-07-14 11:44:07
阅读次数:
148
直接上代码://
// AppDelegate.m
//
//#import "AppDelegate.h"
#import "Person.h"
@interface AppDelegate ()@end@implementation AppDelegate- (void)dealloc {
[_window release];
[super dealloc];
}- (BOOL...
分类:
其他好文 时间:
2015-07-14 11:44:28
阅读次数:
119
直接上代码://
// TableViewController.m
//
//#import "TableViewController.h"@interface TableViewController ()@property (nonatomic, retain) NSMutableData *receivedData ; // 可变的二进...
分类:
其他好文 时间:
2015-07-14 11:42:20
阅读次数:
119
...
分类:
其他好文 时间:
2015-07-14 11:43:20
阅读次数:
190
在开发时,如果遇到使用递归构建树状的组合结构,那么可以考虑使用Composite模式。Composite模式将对象组合成树形结构,来表示部分、整体的层次结构。...
分类:
其他好文 时间:
2015-07-14 11:43:46
阅读次数:
145
直接上代码://
// RootViewController.m
//
//#import "RootViewController.h"
#import "CollectionViewCell.h"
@interface RootViewController ()@property (non...
分类:
其他好文 时间:
2015-07-14 11:44:39
阅读次数:
127