摘要: - (void)viewDidLoad{ [superviewDidLoad]; UIScrollView *scrollview =[[UIScrollView alloc]initWithFrame:CGRectMake(50,0,200,400)]; scrollview.contentSize=CGSizeMake(200,3800);//滑动的范围 scrollview.backgroundColor=[UIColorblueColor]; scrollview.directionalLockEnabled = YES;//这句话需要查查什么意思,注释也可以用 scrollview. 阅读全文
posted @ 2013-08-09 18:13 0xdbe 阅读(525) 评论(0) 推荐(0) 编辑
摘要: 新建项目ProgressStudy打开chenViewController.h添加代码如下#import @interface chenViewController : UIViewController{ UIProgressView *proView; double proValue; NSTimer *timer;}@property(nonatomic, retain) UIProgressView *proView;-(IBAction)btnStartClick;@end打开chenViewController.m在@implementation chenViewController 阅读全文
posted @ 2013-08-09 18:12 0xdbe 阅读(312) 评论(0) 推荐(1) 编辑
摘要: 这是一个简单的计时器,每隔一秒执行一次网上有一篇博客叫你真的会nstimer了吗,可以搜索看看,写的很好- (void)viewDidLoad{ [superviewDidLoad]; NSTimer *timer=[NSTimerscheduledTimerWithTimeInterval:1target:selfselector:@selector(handleTimer:) userInfo:nilrepeats:YES]; //如果是NO则timer在触发了回调函数调用完成之后会释放timer,如果是YES,则会重复调用函数}- (void) handleTimer: (NSTimer 阅读全文
posted @ 2013-08-09 18:10 0xdbe 阅读(288) 评论(0) 推荐(0) 编辑
摘要: [dateformattersetDateFormat:@"YYYY-MM-dd-HH-mm-ss"][dateformattersetDateFormat:@"yyyy-MM-dd-HH-mm-ss"]2014年12月30号结果显示为2015年12月30号改成yyyy就没问题了上面YYYY是wee... 阅读全文
posted @ 2013-08-09 18:09 0xdbe 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 1:NSInteger 与 NSUInteger 和 int与 NSInteger 区别先说说NSInteger 与 NSUInteger,在看书上代码是遇见NSInteger和NSUInteger,不知道什么时候用NSInteger,什么时候用 NSUInteger,在网上搜了一下,NSUInteger是无符号的整型, NSInteger是有符号的整型,在表视图应用中常见 NSUInteger row= [indexPath row];因为这是显示tableViewCell有多少个,只能是非零整数的,也就是说,NSUInteger常用于索引值;int与 NSInteger没有本质区别,只是一 阅读全文
posted @ 2013-08-09 18:08 0xdbe 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 开头就不写了,和前面一样,新建项目UISlider&UISwitchStudy本次实现的UISlider和UISwitch控件用代码实现的一些简单功能,拖动slider 在label上显示slider的值,当slider值大于90的时候,弹出一个警告;switch在变换开关的时候,实现隐藏事件:首先在ViewController.h文件中定义三个控件对象,因为需要使用到Alert的委托方法,添加UIAlertViewDelegate协议,代码如下@interface chenViewController : UIViewController{ UISlider *slider; UIL 阅读全文
posted @ 2013-08-09 18:07 0xdbe 阅读(936) 评论(0) 推荐(0) 编辑
摘要: NSBundle读取图片到视图上,读取plist文件,读取txt文件显示在lable上;bundle是一个目录,其中包含了程序会使用到的资源. 这些资源包含了如图像,声音,编译好的代码,nib文件(用户也会把bundle称为plug-in). 对应bundle,cocoa提供了类NSBundle. 我们的程序是一个bundle. 在Finder中,一个应用程序看上去和其他文件没有什么区别. 但是实际上它是一个包含了nib文件,编译代码,以及其他资源的目录. 我们把这个目录叫做程序的main bundle bundle中的有些资源可以本地化.例如,对于 foo.nib,我们可以有两个版本: 一个 阅读全文
posted @ 2013-08-09 18:06 0xdbe 阅读(1440) 评论(0) 推荐(0) 编辑
摘要: //设置代理- (void)viewDidLoad{ [superviewDidLoad]; //分段控件,页面切换的使用等等 NSArray *array=[NSArray arrayWithObjects:@"选择",@"搜索",@"工具", nil]; UISegmentedControl *segmentCtrl=[[UISegmentedControlalloc]initWithItems:array]; segmentCtrl.frame=CGRectMake(20, 0, 150, 25); segmentCtrl.se 阅读全文
posted @ 2013-08-09 18:03 0xdbe 阅读(454) 评论(0) 推荐(0) 编辑
摘要: 与前面相同,新建一个Single View Application项目。配置也一样,如下图打开chenViewController.m在- (void)viewDidLoad添加方法如下UIAlertView *alert=[[UIAlertViewalloc]initWithTitle:@"确认上线" message:@"你真的要开始了吗" delegate:self cancelButtonTitle:@"不了"otherButtonTitles:@"真的", nil]; [alert show];添加这里是程 阅读全文
posted @ 2013-08-09 18:02 0xdbe 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 和前面一样,新疆项目,与前面不同的是,需要新建一个Plist文件,方法是command+n快捷键如上面,选择Resource的Property List,点击Next如上图,文件名plistdemo如上图,左边资源管理器有一个plistdemo.plist的文件,打开,如上图添加数据直接右键add row或者点击上图红框中的加,(注意前面三角形)如果三角形朝下是建立下级,三角形往右是建立同级数据建好后,右键文件名open as点击 source code将会出现下面xml文件New itemyangphone_num18000000000age21chenphone_num1800000000 阅读全文
posted @ 2013-08-09 17:57 0xdbe 阅读(4080) 评论(0) 推荐(0) 编辑
摘要: 首先新建一个Single View Application项目再配置如下打开chenViewController.h添加协议如下@interface chenViewController : UIViewController//添加UITextFieldDelegate协议,因为TextField里输入内容时需要对键盘进行一些设置。@end打开chenViewController.m添加代码如下- (void)viewDidLoad{ [superviewDidLoad]; //标题 //实例化 UILabel *qqLabel=[[UILabel alloc]initWithFrame:CG 阅读全文
posted @ 2013-08-09 17:54 0xdbe 阅读(540) 评论(0) 推荐(0) 编辑
摘要: 今天配置cnblogs总是出现一点问题,由于没有太多时间,最近一直忙于找工作,就没有花时间研究,但是metaweblog api就是有问题切入正题,首先新建一个Single View Application模板的项目,如下图再输入项目信息,如下图接着打开chenViewController.m再viewDidLoad方法添加代码,如下- (void)viewDidLoad{ [superviewDidLoad]; //新建实例 UIButton*btn=[UIButtonbuttonWithType:UIButtonTypeRoundedRect]; //按钮大小,100,100是以父... 阅读全文
posted @ 2013-08-09 17:48 0xdbe 阅读(622) 评论(0) 推荐(0) 编辑