会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
lvyong
博客园
首页
新随笔
联系
管理
订阅
上一页
1
···
3
4
5
6
7
8
9
10
11
···
15
下一页
2014年6月19日
给UITextField设置头或尾空白
摘要: 有时候,我们需要在UITextField的头尾加入一些空白,如下图所示:其中,黄色和红色部分代表空白。实现起来,比较简单,只需要设置UITextField的leftView、leftViewMode和rightView、rightViewMode即可,代码如下:假设现有UItextField * t...
阅读全文
posted @ 2014-06-19 14:34 Dadada胖纸er
阅读(274)
评论(0)
推荐(0)
2014年6月13日
Objective-C中的关联(objc_setAssociatedObject,objc_getAssociatedObject,objc_removeAssociatedObjects)
摘要: 关联的概念 所谓的关联,字面意思是把两个相关的对象放在一起,实际也是如此。把两个对象相互关联起来,使得其中的一个对象成为另外一个对象的一部分,这就是关联。关联的作用 使用Category,我们可以给一个类增加方法,而不用修改类文件本身。使用关联,我们就可以在类之外为类增加额外的存储空间,跟使用C...
阅读全文
posted @ 2014-06-13 12:12 Dadada胖纸er
阅读(914)
评论(0)
推荐(0)
2014年5月30日
定时器在多线程中的使用
摘要: 在多线程中使用定时器必须开启Runloop,因为只有开启Runloop保持现成为活动状态,才能保持定时器不断执行- (void)viewDidLoad{ [super viewDidLoad]; [self performSelectorInBackground:@selecto...
阅读全文
posted @ 2014-05-30 14:18 Dadada胖纸er
阅读(582)
评论(0)
推荐(0)
2014年5月29日
block知识点
摘要: 1、block引用局部变量的时候,该变量会作为常量编码到block中,在block中不能被修改。2、使用 __block修饰的局部变量,不会作为常量被编码到block中,故而在block中可以被修改。3、在block中引用一个局部的Objective-C对象的时候,该对象会被retain。4、如果不...
阅读全文
posted @ 2014-05-29 17:17 Dadada胖纸er
阅读(187)
评论(0)
推荐(0)
2014年5月26日
UIViewController新方法的使用(transitionFromViewController:toViewController:duration:options:animations:completion:)
摘要: iOS5中,UIViewController新添加了几个方法:- (void)addChildViewController:(UIViewController *)childController NS_AVAILABLE_IOS(5_0);- (void) removeFromParentViewC...
阅读全文
posted @ 2014-05-26 15:00 Dadada胖纸er
阅读(2236)
评论(0)
推荐(0)
2014年5月16日
NSMutableAttributedString 的使用方法,设置格式
摘要: NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:title]; NSRange range = NSMakeRange(0, [attrString length...
阅读全文
posted @ 2014-05-16 11:30 Dadada胖纸er
阅读(412)
评论(0)
推荐(0)
2014年4月25日
statusbar的颜色设置
摘要: 步骤一、在info.plist文件中添加一行(key:View controller-based status bar appearance,value:NO)步骤二、在appDelegate中,添加代码:[[UIApplication sharedApplication] setStatusBar...
阅读全文
posted @ 2014-04-25 18:31 Dadada胖纸er
阅读(568)
评论(0)
推荐(0)
2014年4月16日
获取图片的缩略图
摘要: - (UIImage *) thumbnailImageForImage:(UIImage *) image { CGSize origImageSize = image.size; CGRect newRect = CGRectMake(0, 0, 65, 65); ...
阅读全文
posted @ 2014-04-16 18:31 Dadada胖纸er
阅读(304)
评论(0)
推荐(0)
2014年3月21日
彻底理解position与anchorPoint
摘要: 引言相信初接触到CALayer的人都会遇到以下几个问题:为什么修改anchorPoint会移动layer的位置?CALayer的position点是哪一点呢?anchorPoint与position有什么关系?我也迷惑过,找过网上的教程,大部分都是复制粘贴的,有些是翻译的文章但很有问题,看得似懂非懂,还是自己写代码彻底弄懂了,做点笔记吧。每一个UIView内部都默认关联着一个CALayer, UIView有frame、bounds和center三个属性,CALayer也有类似的属性,分别为frame、bounds、position、anchorPoint。frame和bounds比较好理解,b
阅读全文
posted @ 2014-03-21 11:45 Dadada胖纸er
阅读(9194)
评论(2)
推荐(1)
2014年3月14日
UITextView 设置边框
摘要: UITextView * txtView = [[UITextView alloc] initWithFrame:CGRectMake(10, 50, 200, 50)]; txtView.backgroundColor = [UIColorclearColor]; txtView.layer.masksToBounds = YES; txtView.layer.borderWidth = 1.0f; txtView.layer.borderColor = [UIColorredColor].CGColor; [self.view addSubview:txtView];
阅读全文
posted @ 2014-03-14 15:31 Dadada胖纸er
阅读(389)
评论(0)
推荐(0)
上一页
1
···
3
4
5
6
7
8
9
10
11
···
15
下一页
公告