- 博客(15)
- 收藏
- 关注
原创 UIButton背景图片调整大小
一般情况下 button添加背景图UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(80,130,160,44)]; [button setTitle:@”Test Button” forState:UIControlStateNormal];// Image with withou
2015-03-28 12:49:04
10183
转载 通过色值生成图片
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size { CGRect rect = CGRectMake(0.0f, 0.0f, size.width, size.height); UIGraphicsBeginImageContext(rect.size); CGCon
2014-10-21 17:47:43
714
原创 ios 里如何处理四舍五入的问题
-(NSString *)notRounding:(float)price afterPoint:(int)position{ NSDecimalNumberHandler* roundingBehavior = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown scale:positio
2014-08-14 12:46:49
565
转载 iOS沙盒文件目录
1、获取程序的Home目录[cpp] view plaincopyNSString *homeDirectory = NSHomeDirectory(); NSLog(@"path:%@", homeDirectory); 打印结果:[cpp] view plaincopy
2014-03-27 13:36:42
728
原创 iOS获取本地ip
#include #include - (NSString *)getIPAddress{ NSString *address = @"error"; struct ifaddrs *interfaces = NULL; struct ifaddrs *temp_addr = NULL; int success = 0; //retriev
2014-03-24 13:52:26
729
原创 ios代码倒入声音文件
要求1、 播放的时间不能超过30秒2、数据必须是 PCM或者IMA4流格式 NSString *soundFilePath = [[NSBundlemainBundle] pathForResource: @"seal" ofType: @"mp3"]; CFURLRef thesoundURL = (CFURLRef) [NSURLfileURLWith
2014-03-10 15:32:43
692
原创 iOS如何获取一个后的日期
获取几天后的日期大家都很熟悉,下面介绍一下以月为单位获取日期NSDate *myCurrentDay = [NSDate date];NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *comps
2014-03-06 09:01:57
1056
原创 代码块集成设置UITextField属性
如果是多个UITextField时不用一个个进行设置.h文件@property (weak, nonatomic)IBOutlet UITextField *textSpeed;@property (weak, nonatomic)IBOutlet UITextField *textField;@property (weak, nonatomic)IBOut
2014-03-03 09:54:56
804
原创 iOS7集成设置UINavigationBar字体大小,风格,颜色
NSDictionary *attributes =@{ NSFontAttributeName: [UIFontfontWithName:@"Futura"size:18], NSForegroundColorAttributeName: [UIColorredColor]};[[UINavigationBarappearance] setTitleTextAtt
2014-03-03 09:14:14
1106
原创 NSURLConnection简单使用
NSURLConnection是iOS自带的网络请求,使用灵活1.创建一个NSURL2.通过NSURLRequest 发送3.在通过NSURLConnection连接e.gNSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@“http://www.baidu.com”]
2014-02-24 22:30:51
701
原创 UILabel 自动换行
实现方法:UILabel的自动换行获取UILabel的frame大小获取UILabel的字体大小获取UILabel的文本内容根据上面的3部分数据,计算文本显示区域大小根据4计算的大小,实时改变UILabel的frame nsstring *string = @"自动换行uilabel自适应啦啦啦啦啦啦啦啦"; CGSize labelSize = [s
2014-02-14 18:04:42
898
转载 Objective-C的hook方案: Method Swizzling
在没有一个类的实现源码的情况下,想改变其中一个方法的实现,除了继承它重写、和借助类别重名方法暴力抢先之外,还有更加灵活的方法吗?在Objective-C编程中,如何实现hook呢?标题有点大,计划分几篇来总结。本文主要介绍针对selector的hook,主角被标题剧透了———— Method Swizzling 。Method Swizzling 原理
2014-02-10 13:35:30
637
原创 旧工程配置arc方案
直接在targets->build phases中修改compiler Flags,是否支持arc。添加:-fobjc-arc,就可以让旧项目支持arc。如果想让原来支持arc的不使用arc则添加-fno-objc-arc
2014-01-20 12:32:07
677
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人