摘要: In this Objective-C tutorial, you will create a simple movie quotes quiz app. Along the way, you’ll become acquainted with a number of aspects of Objective-C, including:(在这章节中,你将会了解到OC的一些特性。包括了:)mutable arraysproperty listsclassesmethods@propertyprotocols and delegatesadditional string functions (st 阅读全文
posted @ 2013-12-22 18:06 ymonke 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 注:这是raywenderlich博客上的一个系列文章。是写给从其他语言转到OC语言上的程序员的,一共5节。最近打算学习一下,并且把一些重要的知识点摘抄并且尝试翻译一下,第一次翻译,有些原文如果不知道如何翻译,放上原文。(这TM还算翻译)一、Objectively Speaking: A Crash Course in Objective-C for iOS 6In this tutorial, you will create a simple app that randomly generate quotes from a stored list. In doing so, you’ll b 阅读全文
posted @ 2013-12-22 16:49 ymonke 阅读(387) 评论(0) 推荐(0) 编辑
摘要: [译] 几点 iOS 开发技巧原文:iOS Programming Architecture and Design Guidelines原文来自破船的分享原文作者是开发界中知晓度相当高的 Mugunth Kumar,他是 MKNetworkKit 的作者(虽然没有 AFNetworking 使用那么广泛,但也是一个很棒的 Network Kit),更是最近流传甚广的《iOS 5/6 Programming – Pushing The Limits》的作者。文章中 MK 介绍了几点开发中常用的小技巧,几条 Tips 简单易懂,但是很实用,不但可以提高开发效率,而且可以提高代码的可读性和可复用性。 阅读全文
posted @ 2013-12-19 09:17 ymonke 阅读(510) 评论(0) 推荐(0) 编辑
摘要: 1、UITextView在UITableViewCell 中自适应高度的问题 1 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 2 { 3 。。。。。。 4 5 UITextView * contentView = [[UITextView alloc] initWithFrame:CGRectZero]; 6 contentView.textColor = [UIColor colorWithRed:80.0/2... 阅读全文
posted @ 2013-12-19 09:04 ymonke 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1、plist文件的读取保存位置:工程沙盒里(就是程序user Document文件夹下,以读取文件,写入文件方式)工程自身里(就是在工程里手动创建一个如.plist文件,把固定的内容写入,这个需要人工手动写入)工程沙盒里(保存到user Document下,不过不需要读写文件,用系统的NSUserDefaults 可以快速保存添加读取删除基本数据类型,类似于android里的Sharedpreferences)读取方法:工程路径:1 //path 读取当前程序定义好的provinces.plist省份城市文件 2 NSString *path = [[NSBundle mainBundle] 阅读全文
posted @ 2013-12-19 09:00 ymonke 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 1、BOOL值与YES,NO早期的C 语言中是没有布尔类型的(C99 增加了布尔类型),Objective-C 中增加BOOL 类型来表示YES、NO,注意不是TRUE、FALSE。BOOL 使用了一个8 位(一个字节)的整数进行表示,8 位全0 就是NO。我们知道C 语言中非0 值即为逻辑真,因此常常会有int i=5;while(i){… …}的写法。在Objective-C 中一定要注意慎用C 语言中的这种数字与逻辑真假混合对待的做法去操作BOOL类型变量。例如:BOOL bi=8960;if(bi==YES){printf("YES");}这里会输出YES 吗?不会 阅读全文
posted @ 2013-12-19 08:59 ymonke 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 一、效果图:二、概述实现一个好友列表,可以分为男女两个选项,并且实现搜索和排序功能。我的数据是放在plist文件中。三、代码简述代码结构如图,首先自定义一个Cell。cell.h 1 #import 2 3 @interface MyCell : UITableViewCell 4 5 @property (nonatomic,retain) UIButton *tickButton; 6 @property (nonatomic,retain) UIImageView *selectView; 7 @property (nonatomic,retain) UIImageView *he... 阅读全文
posted @ 2013-12-17 20:16 ymonke 阅读(1969) 评论(0) 推荐(0) 编辑
摘要: 一、概述 策略模式:定义一系列的算法,把每一个算法封装起来, 并且使它们可相互替换。本模式使得算法可独立于使用它的客户而变化。也称为政策模式(Policy)。(Definea family of algorithms,encapsulate each one, andmake them interchangeable. Strategy lets the algorithmvary independently from clients that use it.)(策略模式把对象本身和运算规则区分开来,其功能非常强大,因为这个设计模式本身的核心思想就是面向对象编程的多形性的思想。) 策略模... 阅读全文
posted @ 2013-12-17 16:28 ymonke 阅读(794) 评论(0) 推荐(0) 编辑
摘要: 1、UITextView 如何设置行间距?@interface UITextView ()- (id)styleString; // make compiler happy@end@interface MBTextView : UITextView@end@implementation MBTextView- (id)styleString { return [[super styleString] stringByAppendingString:@"; line-height: 1.2em"];}@end效果图如上。 阅读全文
posted @ 2013-12-10 16:01 ymonke 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1、UILabel文字换行问题 bodyLabel.text =@"亲,恭喜您修改密码\n成功了"一开始我的代码是这样写的,但是没有效果。 后来查了一下,原来还需要加上两行代码: bodyLabel.lineBreakMode = UILineBreakModeWordWrap; bodyLabel.numberOfLines = 0; UILineBreakModeWordWrap =0, // 以空格为界,保留整个单词 UILineBreakModeCharacterWrap, // 保留整个字符 UILineBreakModeClip, // 画到... 阅读全文
posted @ 2013-12-09 17:05 ymonke 阅读(114) 评论(0) 推荐(0) 编辑