2015年7月24日

手把手教学:巧用Core Data和RubyMotion开发iOS应用

摘要: http://www.csdn.net/article/2015-07-13/2825195-RubyMotion-iOS-Core-Data 阅读全文

posted @ 2015-07-24 16:26 yucaijiang 阅读(222) 评论(0) 推荐(0)

27个提升效率的iOS开源库推荐

摘要: 27个提升效率的iOS开源库推荐DZNEmptyDataSet(UI,空表格视图解算器) PDTSimpleCalendar(UI,drop-in日历组件) MagicalRecord(实施活跃记录模式的Core Data助手) Chameleon(UI,色彩框架) Alamofire(Swift ... 阅读全文

posted @ 2015-07-24 16:25 yucaijiang 阅读(295) 评论(0) 推荐(0)

HTTP Authorization

摘要: 用中文简述一下http auth的过程:客户端发送http请求服务器发现配置了http auth,于是检查request里面有没有"Authorization"的http header如果有,则判断Authorization里面的内容是否在用户列表里面,Authorization header的典型... 阅读全文

posted @ 2015-07-24 16:08 yucaijiang 阅读(563) 评论(0) 推荐(0)

两种方法删除NSUserDefaults所有记录

摘要: //方法一NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];//... 阅读全文

posted @ 2015-07-24 13:54 yucaijiang 阅读(341) 评论(0) 推荐(0)

label调整字间距,调整行间距

摘要: number = 1.0f//调整字间距CFNumberRef num = CFNumberCreate(kCFAllocatorDefault,kCFNumberSInt8Type,&number;);[attributedString addAttribute:(id)kCTKernAttrib... 阅读全文

posted @ 2015-07-24 13:51 yucaijiang 阅读(1908) 评论(0) 推荐(0)

继承图

摘要: 阅读全文

posted @ 2015-07-24 13:49 yucaijiang 阅读(248) 评论(0) 推荐(0)

iphone手机屏幕大小

摘要: 4/4s 320*4805/5s 320*5686 375*6676plus 414*736 阅读全文

posted @ 2015-07-24 13:43 yucaijiang 阅读(222) 评论(0) 推荐(0)

app 图标需要的大小

摘要: 58*58 87*8780*80120*120180*180 阅读全文

posted @ 2015-07-24 13:40 yucaijiang 阅读(233) 评论(0) 推荐(0)

多了一层或者多层响应者 如何实现跳转

摘要: //从控制器1跳转到控制器2 MyHealthdetailTableViewController *v2=[[MyHealthdetailTableViewController alloc]init];//控制器2 //响应者链条才能push MyCollectHealhTableViewCon... 阅读全文

posted @ 2015-07-24 13:36 yucaijiang 阅读(217) 评论(0) 推荐(0)

内存分区

摘要: //栈的特性/*void test(){ int d=0; int e=0;}int main(int argc, const char * argv[]){ //栈区:特性先进后出(后进先出) int a=10;//1 int b=10;//2 int c=10;//3 //创建顺序:1,2,... 阅读全文

posted @ 2015-07-24 11:58 yucaijiang 阅读(219) 评论(0) 推荐(0)

指针

摘要: //1.指针:地址//2.指针变量:存放地址的变量//3.&取地址运算符 *取值运算符 %p地址站位符//4.int *p=NULL; 这里的*号只是提醒这是一个指针//5.p=&a; 取出a的值//6.printf("%p",p); 打印这个地址//7.printf("%d"*p); 打印地址中存... 阅读全文

posted @ 2015-07-24 11:56 yucaijiang 阅读(213) 评论(0) 推荐(0)

二维数组

摘要: //二维数组 //行可以省,列不可以省 /* int a[2][3]={{1,2,3},{4,5,6}};//里面{}是为了方便辨识,可有可无 int a[][3]={1,2,3,4,5,6}; //系统会自动识别每行有三个数,因为一共有6个数,所有一共有2行,固第一个[]行里面为2,第二个[]列... 阅读全文

posted @ 2015-07-24 11:55 yucaijiang 阅读(307) 评论(0) 推荐(0)

查找字符串中的空格数

摘要: char a[]="i love ios,i want an iphone5s"; int test=0; //记录有多少空格的变量 for(int i=0;i<strlen(a);i++){ if(a[i]==' '){ //判断是否等于空格 test++; } }printf("%d\n",te... 阅读全文

posted @ 2015-07-24 11:53 yucaijiang 阅读(839) 评论(0) 推荐(0)

将字符串倒转

摘要: char a[]="afjnpue ""; int min=0; unsigned long max=strlen(a)-1; char temp=0; while(min<=max){ temp =a[min]; a[min]=a[max]; a[max]=temp; min++; max--... 阅读全文

posted @ 2015-07-24 11:53 yucaijiang 阅读(146) 评论(0) 推荐(0)

随机产⽣10个[20,40]数,并对10个数从⼩到da排序。

摘要: int temp=0; int a[10]={0}; for (int i=0;ia[j+1]){ temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } for(int i=0;i<10;i++){ printf("%d\n",a[i]); } 阅读全文

posted @ 2015-07-24 11:53 yucaijiang 阅读(209) 评论(0) 推荐(0)

字符串拼接/比较

摘要: //字符串拼接 /* char a[20]="iphone"; //a必须留上足够的容量 以便拼接b char b[]="6plus"; strcat(a,b); printf("%s",a); *///字符串比较 /* char a[]="ab"; //在第二位上面比出来大小 后面的不比较 cha... 阅读全文

posted @ 2015-07-24 11:52 yucaijiang 阅读(252) 评论(0) 推荐(0)

计算字符串长度

摘要: //字符数组 /* char a[7]={'i','p','h','o','n','e','\0'};//[]里面的数量必须比元素数量大一个,用来放'\0' ,是结束的标志,不参与输出 printf("%s\n",a); char b[]="iphone 6 plus"; //这里如果是一串字符 ... 阅读全文

posted @ 2015-07-24 11:51 yucaijiang 阅读(229) 评论(0) 推荐(0)

拷贝字符串

摘要: char a[]="iphone"; char b[7]={0}; //容量不可以比a小 strcpy(b,a); //表示把a里面的拷贝到b里面 空的在前 有元素的在后面 printf("%s",b); 阅读全文

posted @ 2015-07-24 11:51 yucaijiang 阅读(193) 评论(0) 推荐(0)

冒泡排序

摘要: // sort[5]={4,3,2,1,0}排序 /* int a[5]={4,3,2,1,0}; //定义一个元素数组 int b=0; for(int i=1;ia[j+1]){ b=a[j]; //两个元素交换 a[j]=a[j+1]; a[j+1]=b; } } } for(int i=0;... 阅读全文

posted @ 2015-07-24 11:50 yucaijiang 阅读(216) 评论(0) 推荐(0)

循环(打印一些小东西)

摘要: //打印1到100之间7的倍数 /* int a=1; //定义一个计数值 while(a=0)&&(a-70<=9)) printf("%d\n",a); a++; }*///打印1到100之间不是7的倍数并且不包含7的数 int a=1; while (a<=100){ if((a%7!=0)&... 阅读全文

posted @ 2015-07-24 11:48 yucaijiang 阅读(290) 评论(0) 推荐(0)

iOS内存小知识

摘要: //ios没有垃圾回收机制,oc有垃圾回收机制,mac有垃圾回收机制,mac在10.1版本后被启用//mrc(引用计数)手动分配并释放 //alloc 分配空间//retain 引入计数加1//copy 复制(另开辟空间,和原来的一样)//release 释放,引用计数减1//autorelease... 阅读全文

posted @ 2015-07-24 11:41 yucaijiang 阅读(280) 评论(0) 推荐(0)

NSset

摘要: //NSset {()}集//不可变的 //便利构造器创建一个集 NSSet *set1=[NSSet setWithObjects:@"1",@"2",@"3",@"4", nil]; NSLog(@"%@",set1); //使用集 //返回元素个数 [set1 count]; //随机返回... 阅读全文

posted @ 2015-07-24 11:37 yucaijiang 阅读(251) 评论(0) 推荐(0)

字典

摘要: /* //数组 + 字典 + 集 = 集合 //键(key) 值(Value) 对 是一个整体 //输出大括号是字典,小括号是数组//不可变字典//创建一个字典 //1.正常的初始化方法 NSDictionary *dict1=[[NSDictionary alloc] initWithObject... 阅读全文

posted @ 2015-07-24 11:36 yucaijiang 阅读(237) 评论(0) 推荐(0)

NSNumber

摘要: //NSNumber //int类型转化为对象 int i=10; NSNumber *n1=[NSNumber numberWithInt:i]; NSLog(@"%@",n1); //float类型转化为对象 float f=1.3; NSNumber *n2=[NSNumber numberW... 阅读全文

posted @ 2015-07-24 11:34 yucaijiang 阅读(199) 评论(0) 推荐(0)

NSString

摘要: /*//不可变字符串NSString.//1.初始化//使用字符串常量初始化 NSString *s1=@"hello"; //初始化方法 NSString *s2=[[NSString alloc] initWithFormat:@"%@world",s1]; NSLog(@"s2:%@",s... 阅读全文

posted @ 2015-07-24 11:33 yucaijiang 阅读(203) 评论(0) 推荐(0)

NSArray

摘要: /NSArray 不可变数组 //OC中的数组只能存对象,不可以存标量(int float double bool char) //1.常量的方式初始化一个数组 //OC的数组也不可以越界 NSArray *arr1=@[@"1",@"2",@"3",@"3"]; NSLog(@"%@",arr1... 阅读全文

posted @ 2015-07-24 11:33 yucaijiang 阅读(229) 评论(0) 推荐(0)

和layer有关的东西

摘要: self.myView=[[UIView alloc]initWithFrame:CGRectMake(50, 50, 200, 200)]; self.myView.backgroundColor=[UIColor redColor]; [self.view addSubview:self.myV... 阅读全文

posted @ 2015-07-24 11:29 yucaijiang 阅读(213) 评论(0) 推荐(0)

归档反归档

摘要: //归档 反归档(麻烦的方法) /* //归档 //创建Person实例对象 Person *person1=[[Person alloc]init]; person1.name=@"bbb"; person1.age=@"39"; Person *person2=[[Person alloc]... 阅读全文

posted @ 2015-07-24 11:24 yucaijiang 阅读(239) 评论(0) 推荐(0)

NSFileManager

摘要: //访问沙盒路径 /* //1.Home主目录(沙盒主目录:里面有Documents,Library,tmp 和一个应用程序) NSLog(@"%@",NSHomeDirectory()); //2.Documents NSString *DocumentsPath=NSSearchPathFor... 阅读全文

posted @ 2015-07-24 11:23 yucaijiang 阅读(207) 评论(0) 推荐(0)

iOS 简单的文件写入

摘要: //访问沙盒路径 /* //1.Home主目录(沙盒主目录:里面有Documents,Library,tmp 和一个应用程序) NSLog(@"%@",NSHomeDirectory()); //2.Documents NSString *DocumentsPath=NSSearchPathFor... 阅读全文

posted @ 2015-07-24 11:21 yucaijiang 阅读(840) 评论(0) 推荐(0)

iOS弹出窗口

摘要: UIAlertView *alterView=[[UIAlertView alloc]initWithTitle:@"警告" message:@"登陆成功" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; [... 阅读全文

posted @ 2015-07-24 11:13 yucaijiang 阅读(311) 评论(0) 推荐(0)

iOS block传值和属性传值

摘要: 第一个控制器:-(void)barAction:(UIBarButtonItem*)sender{ NextViewController *next=[[NextViewController alloc]init]; //拿当前页面的值传到后一个页面 next.stringValue=self.rv... 阅读全文

posted @ 2015-07-24 11:11 yucaijiang 阅读(768) 评论(0) 推荐(0)

iOS给所有的TabBar和NavigationBar换颜色

摘要: //一键换肤 [[UINavigationBar appearance]setBarTintColor:[UIColor redColor]];//给所有的NavigationBar换颜色 [[UITabBar appearance]setBarTintColor:[UIColor blueCo... 阅读全文

posted @ 2015-07-24 11:05 yucaijiang 阅读(518) 评论(0) 推荐(0)

iOS获取沙盒路径并写入文件

摘要: .h文件中//你需要的数据集合形式@property(nonatomic,strong)NSMutableArray *groupArray;//数组@property(nonatomic,strong)NSMutableDictionary *allDict;//字典//判断沙盒里面是否有需要的对... 阅读全文

posted @ 2015-07-24 11:03 yucaijiang 阅读(1520) 评论(0) 推荐(0)

uilabel自适应高度

摘要: NSString *str=@"// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to p... 阅读全文

posted @ 2015-07-24 10:58 yucaijiang 阅读(240) 评论(0) 推荐(0)

iOS 快速索引

摘要: //设置快速索引-(NSArray*)sectionIndexTitlesForTableView:(UITableView *)tableView{ return self.headArray;} 阅读全文

posted @ 2015-07-24 10:50 yucaijiang 阅读(194) 评论(0) 推荐(0)

iOS模态视图

摘要: //模态视图(临时弹出使用) GreenViewController *green=[[GreenViewController alloc] init]; green.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal; [self... 阅读全文

posted @ 2015-07-24 10:49 yucaijiang 阅读(235) 评论(0) 推荐(0)

UIPageControl 属性

摘要: //分页控制器UIPageControl self.page=[[UIPageControl alloc]initWithFrame:CGRectMake(50, 100, 200, 50)]; self.page.backgroundColor=[UIColor grayColor]; self.... 阅读全文

posted @ 2015-07-24 10:48 yucaijiang 阅读(235) 评论(0) 推荐(0)

UIScrollView常用方法

摘要: //缩放- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{ //返回要缩放的视图 return self.rv.imV;}//- (void)scrollViewDidScroll:(UIScrollView *)sc... 阅读全文

posted @ 2015-07-24 10:44 yucaijiang 阅读(220) 评论(0) 推荐(0)

UIScrollView属性

摘要: UIImage *image=[UIImage imageNamed:@"1.png"]; //滚动视图 self.scrollV=[[UIScrollView alloc] init]; self.scrollV.frame=[UIScreen mainScreen].bounds; self.s... 阅读全文

posted @ 2015-07-24 10:43 yucaijiang 阅读(205) 评论(0) 推荐(0)

iOS 中UISlider常用知识点

摘要: self.slider=[[UISlider alloc]initWithFrame:CGRectMake(50, 100, 200, 50)];//self.slider.tintColor=[UIColor blueColor];//已经使用进度条颜色 //数值减小(球左边)颜色 self.... 阅读全文

posted @ 2015-07-24 10:41 yucaijiang 阅读(360) 评论(0) 推荐(0)

iOS中UISegmentedControl常用属性

摘要: NSArray *array=@[@"红",@"黄",@"蓝"]; //数组中有多少元素,分段控制就有多少条目(分段) self.seg=[[UISegmentedControl alloc] initWithItems:array]; //选中某一个 self.seg.selectedSegme... 阅读全文

posted @ 2015-07-24 10:39 yucaijiang 阅读(326) 评论(0) 推荐(0)

iOS触摸事件

摘要: {//开始触摸点 CGPoint _startPoint;}- (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { // Initialization code //给testVIew加上颜... 阅读全文

posted @ 2015-07-24 10:21 yucaijiang 阅读(240) 评论(0) 推荐(0)

iOS appdelegate 中将自定义的视图作为启动视图

摘要: #import "RootViewController.h" RootViewController *rootVC=[[[RootViewController alloc] init] autorelease]; self.window.rootViewController=rootVC; 阅读全文

posted @ 2015-07-24 10:18 yucaijiang 阅读(531) 评论(0) 推荐(0)

iOS内存警告处理

摘要: - (void)didReceiveMemoryWarning//内存警告{ [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. NSLog(@"内存快爆了"); //判断是否加载过... 阅读全文

posted @ 2015-07-24 10:15 yucaijiang 阅读(222) 评论(0) 推荐(0)

iOS 自定义一个视图作为根视图

摘要: #import "myView.h"//使用这个myview来代替控制器自带的view@property(nonatomic,retain)myView *myview;- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *... 阅读全文

posted @ 2015-07-24 10:14 yucaijiang 阅读(553) 评论(0) 推荐(0)

程序启动流程

摘要: //将要开始编辑- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{ NSLog(@"快要开始编辑了"); return YES;}- (void)applicationWillResignActive:(UIApplicatio... 阅读全文

posted @ 2015-07-24 10:10 yucaijiang 阅读(227) 评论(0) 推荐(0)

iOS 回收键盘

摘要: 先要遵循协议 设置代理 self.jiagetextfield.delegate=self; self.mingchengtextfield.delegate=self;//释放第一响应者-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent ... 阅读全文

posted @ 2015-07-24 10:08 yucaijiang 阅读(213) 评论(0) 推荐(0)

uibutton的常用属性

摘要: //UIButton UIButton *button=[UIButton buttonWithType:UIButtonTypeSystem]; button.frame=CGRectMake(100, 100, 100, 100); button.backgroundColor=[UIColor... 阅读全文

posted @ 2015-07-24 10:06 yucaijiang 阅读(255) 评论(0) 推荐(0)

uitextfield的常用属性

摘要: //文本框 UITextField *textField=[[UITextField alloc] initWithFrame:CGRectMake(50, 50, 200, 50)]; //textField.backgroundColor=[UIColor yellowColor]; //文本... 阅读全文

posted @ 2015-07-24 10:05 yucaijiang 阅读(337) 评论(0) 推荐(0)

uilabel的常用属性

摘要: UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 200)]; label.backgroundColor=[UIColor yellowColor]; label.text=@"账号";//不可更改文... 阅读全文

posted @ 2015-07-24 10:04 yucaijiang 阅读(199) 评论(0) 推荐(0)

uiview的常用属性

摘要: //背景颜色 self.window.backgroundColor = [UIColor whiteColor]; //让window能够显示出来 //透明度 self.window.alpha=1.0; /* //所有的控件都继承与UIView //第一步:对视图开辟空间,并初始化 UIVie... 阅读全文

posted @ 2015-07-24 10:03 yucaijiang 阅读(190) 评论(0) 推荐(0)

根据服务器返回值做判断

摘要: if ([responseObject[@"msg"]isEqualToString:@"暂时还没有收藏产品!"]) {// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"没有收藏产品" message:nil delegate:... 阅读全文

posted @ 2015-07-24 09:51 yucaijiang 阅读(251) 评论(0) 推荐(0)

解析字典套字典

摘要: //解析字典套字典-(void)requestUrl{ NSString *str = [NSString stringWithFormat:@"http://www.aliyueba.com:8080/ci/index.php/api/lists/shop_de?shopid=%@&cateid=... 阅读全文

posted @ 2015-07-24 09:47 yucaijiang 阅读(302) 评论(0) 推荐(0)

解析字典套数组套字典(有分业功能)

摘要: //解析字典套数组套字典-(void)requestUrl{ //NSUserDefaults *user = [NSUserDefaults standardUserDefaults]; //[user valueForKey:@"用户"]; NSUserDefaults *user = [NSU... 阅读全文

posted @ 2015-07-24 09:45 yucaijiang 阅读(395) 评论(0) 推荐(0)

跳转到storyboard控制器代码

摘要: - (IBAction)loginAction:(id)sender { UIStoryboard *main=[UIStoryboard storyboardWithName:@"Main" bundle:nil];//storyboard标示 RegisterViewController *... 阅读全文

posted @ 2015-07-24 09:41 yucaijiang 阅读(250) 评论(0) 推荐(0)

导航