- 博客(51)
- 收藏
- 关注
原创 dismissModalViewControllerAnimated
如果A推出B,需要在A处使用dismissModalViewControllerAnimated方法。
2014-04-04 17:44:22
545
原创 iOS中CFUUIDRef,CFUUIDCreate声称唯一字符串
CFUUIDRef theUUID =CFUUIDCreate(NULL); CFStringRef guid = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID); NSString *uuidString = [((NSString *)guid)stringByReplacingOccurrenc
2014-04-04 17:02:47
2667
原创 UIRefressController下拉刷新 刷新记录上次时间
新建的是继承自uirefreshcontroller类,具体代码如下- (void)viewDidLoad{ [superviewDidLoad]; // Uncomment the following line to preserve selection between presentations. // self.clear
2014-01-07 10:39:37
756
原创 UIBarButton,UINavigationItem,UINavigationBar,UIToolear区别
UINavigationController:管理UIView使用视图控制器 管理视图控制器UINavigationController切换 push… pop…以栈的形式管理UIViewControllerUIViewController切换 presentViewController /dissmiss..UIViewController管理UIView: ctl.view
2013-12-30 10:39:19
922
原创 UINavigateController到指定层数,退到指定层数
- (void)viewDidLoad{ [superviewDidLoad];// Do any additional setup after loading the view. self.navigationItem.titleView.frame =CGRectMake(120,0, 80,30); self.title
2013-12-30 09:07:48
784
原创 导航控制器:UINavigationController
/* 导航控制器:UINavigationController继承自UIViewController 视图控制器:UIViewController UINavigationController:管理UIViewController UIViewController:管理UIView UINavigationCont
2013-12-29 21:36:43
681
原创 oc学习之旅:简单协议
#import #import "Boss.h"#import "Coder.h"int main(int argc,const char * argv[]){ @autoreleasepool { /* 协议:本质就是一组接口 协议代理作用在:传参
2013-12-26 19:37:04
534
原创 oc学习之旅:数组浅拷贝深拷贝
//copy NSString * str1 = @"wahaha"; NSString * str2 = [str1 copy]; NSString * str3 = [str1 retain]; NSLog(@"str1 %p str2 %p str4 %p",str1,str2,str3);
2013-12-26 19:25:29
808
原创 oc学习之旅:KVO
#import #import "Bank.h"#import "Person.h"int main(int argc,const char * argv[]){ @autoreleasepool { /* KVC:义字符串替代访问器(getter setter)修改成员变量
2013-12-26 19:05:29
611
原创 KVC
#import #import "Person.h"#import "Group.h"int main(int argc,const char * argv[]){ @autoreleasepool { /* KVC:Key Value Coding */ Per
2013-12-26 18:58:31
558
原创 oc学习之旅:协议 银行转账
协议:TellREcevie.h 与 SendProtocol.hTellREcevie.h-(void)tellRecevie:(NSNumber *)money;SendProtocol.h-(void)sendMoney:(NSNumber *)money;流程,userA转钱给银行,银行转钱给B,B收到钱了通知银行,银行通知A#
2013-12-26 18:37:20
648
原创 oc学习之旅:内存管理,文件操作流程
#import #import "Tail.h"#import "Cat.h"#define PATH @"XXXXXXXXXXXXXX"int main(int argc,const char * argv[]){ @autoreleasepool { /* NSFi
2013-12-26 17:54:21
637
原创 oc学习之旅:自动释放池
#import #import "Person.h"int main(int argc,const char * argv[]){ // NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];早期自动释放池 @autoreleasepool { /*
2013-12-26 17:49:26
558
原创 oc学习之旅:协议
构造一个士兵代理教官的开火的方法,并返回一个对话,教官有相应的对话,然后让士兵去执行。main#import #import "Master.h"#import "Solider.h"int main(int argc,const char * argv[]){ @autoreleasepool {
2013-12-26 17:46:42
595
原创 UIView实现星级评定
准备两张五颗星的图片中,有一张是灰色的一张是黄色的星星,效果为点到一定区域就会显示半颗星和一个星变黄。在黄色星星上应该采用clipsToBounds来显示图片达到评分效果。每个星星的位置分为三段,第一段评分上一科星星的分数,第二段评分为半颗星的分数,第三段分为整颗星星的分数。运用逻辑运算来实现该分数。 UIImageView *imgView = [[UIImageViewalloc
2013-12-26 17:30:18
1025
原创 停靠模式:子视图自适应父视图长度宽度左边距右边距上下边距
UIView *v = [[UIViewalloc] initWithFrame:CGRectMake(0,20, 200, 200)]; v.tag =100; v.backgroundColor = [UIColororangeColor]; [self.windowaddSubview:v]; [vrelease];
2013-12-26 14:40:40
748
原创 UIView视图移动,抖动效果,定时器,动画block
for (int i =0; i2; i++) { UIImageView * img = [[UIImageViewalloc] initWithFrame:CGRectMake(270*i,20+410*i, 50, 50)]; if (i == 0) { img.image = [UIImageimageN
2013-12-26 11:57:51
1022
原创 UIView-tag循环图片点击图片
//添加初始图片 UIImageView *imgView = [[UIImageViewalloc] initWithFrame:CGRectMake(0,20, 250, 300)]; imgView.center =CGPointMake(160,240); imgView.image = [UIImageimageNamed:@"1.
2013-12-26 09:43:19
671
原创 UILabel仿qq对话
NSArray *arr = [[NSArrayalloc] initWithObjects:@"我发现你越来越不爱我了,只爱你的工作!",@"我怎么不爱你了?",@"我明天不吃饭了,去把你经理打一顿!",@"为什么打我经理?",@"呜你果然不爱我了!你都不问我为什么不吃饭..",nil]; CGFloat>20; UILabel * label;
2013-12-25 19:37:02
733
原创 oc学习之旅:内存管理2修改数组为非ARC版本
为了重写数组的非arc版本,特意添加了一个Person类,把Person添加到自定义的数组类中,因为是强引用,所以添加完后把Person类释放掉,然后再把每个元素释放掉后会打印Person与自定义数组类的dealloc方法,顺序是先是调用Person的dealloc在调用自定义数组类的dealloc。每个功能都要实现内存管理,这样才不导致内存泄露#import #import "P
2013-12-25 19:10:24
614
原创 UIView-tag
UIView *v =[[UIViewalloc] initWithFrame:CGRectMake(10,20, 320, 30)]; v.tag =200; v.backgroundColor = [UIColorblackColor]; [self.windowaddSubview:v]; [vrelea
2013-12-25 17:50:22
697
原创 uiview子视图Center中心点2,层层叠加子视图,release与removeFromSuperview区别
/* UIView: 坐标相关属性:frame位置 大小 bounds(以自身为参考坐标 起始点(0,0)) center中心点(相对于父视图而言) UIView只能有一个父视图 可以有多个子视图 */ UIView *v =[[UIViewalloc] initW
2013-12-25 17:45:00
1386
原创 UIView子视图Center中心点
/* UIView: 坐标相关属性:frame(相对父视图而言)位置大小 bounds(以自身为参考坐标起始点(0,0)) center 中心点(相对父视图而言) UIView只能有一个父视图 但可以有多个子视图 */ UIView * v = [[UIViewalloc]
2013-12-25 17:31:53
1104
原创 UIView操作:插入添加置顶,判断一个视图是否为子视图view
for (int>0;>3; i++) { UIView *v = [[UIViewalloc] initWithFrame:CGRectMake(30*i,30*i+50, 80, 80)]; v.backgroundColor =[[UIColoralloc] initWithRed:arc4random()%256/255.0gr
2013-12-25 17:10:36
6479
原创 UIBUTTON添加图片点击-tag一个图片亮其他图片都灭
//给按钮设置图片 [b setImage:[UIImageimageNamed:@"unchecked.png"]forState:UIControlStateNormal]; [b addTarget:selfaction:@selector(click:)forControlEvents:UIControlEventTouchUpInside];
2013-12-25 17:08:33
722
原创 UIBUTTON电话界面
//7.0着色 //父视图着色改变那么上面的所有的子视图着色都会改变 self.window.tintColor = [UIColorredColor]; //7.0无边框按钮 for (int i=0; i7 ;i++) { UIButton *b =[UIButtonbuttonWithType
2013-12-24 16:57:39
558
原创 UIImageView
/* UIImage 保存图片数据 UIImageView显示图片 */ //读取工程文件中得图片 //某一个张图片会被多次显示时优先使用 UIImage *img = [UIImageimageNamed:@"640*960.png"]; //图片仅仅显示一次又不想占用缓存空间优先
2013-12-24 14:29:25
499
原创 UIBUTTON点击事件
#import "Person.h"@implementation AppDelegate- (void)dealloc{ [_arrrelease]; [self.windowrelease]; [superdealloc];}- (BOOL)application:(UIApplication *)applicati
2013-12-24 11:57:38
1119
原创 UIView显示对话
float curHeight =20; //字体字典修改字典 //ios7.0 NSDictionary *dic; if (SYSTEMVERSION_7) { UIFont *font =[UIFontsystemFontOfSize:17]; dic =[NSDict
2013-12-24 10:37:27
513
原创 UIBUTTON
UIButton *b =[UIButtonbuttonWithType:UIButtonTypeInfoLight]; b.frame =CGRectMake(50,50, 50, 50); [b addTarget:selfaction:@selector(click)forControlEvents:UIControlEventTouchUpIns
2013-12-24 09:24:27
411
原创 UIView给控件边框加阴影
UIView *v =[[UIViewalloc] initWithFrame:CGRectMake(50,50, 50, 50)]; v.backgroundColor = [UIColorblackColor]; v.layer.shadowOpacity =0.8; v.layer.shadowOffset =CGSizeMake
2013-12-24 09:06:04
846
原创 UI第2课UILable第3课自动换行
//7.0以前使用 //判断当前系统的软件版本 float f = [UIDevicecurrentDevice].systemVersion.floatValue; if (f>=7.0) { NSLog(@"使用7.0方法"); }else{ NSLog(@"使用7.0之前的方法")
2013-12-23 16:55:02
490
原创 UI第2课UILable
AppDelegate.m /* UILabel: */ UILabel *label = [[UILabelalloc] initWithFrame:CGRectMake(0,20, 200, 50)]; //设置文字 label.text =@"wahaha"; label.backgro
2013-12-23 16:52:48
464
原创 UI第一课
main /* 1.创建应用程序对象 UIApplication 2.创建应用程序代理 AppDelegate是UIApplication的代理 3.启动事件循环 runLoop */ returnUIApplicationMain(argc, argv,
2013-12-23 15:20:08
516
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人