1.压缩图片

  1. #pragma mark 处理图片
  2. - (void)useImage:(UIImage *)image
  3. {
  4. NSLog(@"with-----%f heught-----%f",image.size.width,image.size.height);
  5. float  scales = image.size.height / image.size.width; //图片比例
  6. NSLog(@"图片比例:%f",scales);
  7. UIImage * normalImg;
  8. if (image.size.width >300 || image.size.height > 300) {
  9. if (scales > 1) {
  10. normalImg = [self imageWithImageSimple:image scaledToSize:CGSizeMake(300 / scales, 300)];
  11. }else {
  12. normalImg = [self imageWithImageSimple:image scaledToSize:CGSizeMake(300 ,3300 * scales)];
  13. }
  14. }
  15. else {
  16. normalImg = image;
  17. }
  18. NSLog(@"第一次处理后:with-----%f height-----%f",normalImg.size.width, normalImg.size.height);
  19. CGSize newSize = CGSizeMake(normalImg.size.width, normalImg.size.height);
  20. float kk = 1.0f;//图片压缩系数
  21. int mm;//压缩后的大小
  22. float aa = 1.0f;//图片压缩系数变化步长(可变)
  23. mm = (int)UIImageJPEGRepresentation(normalImg, kk).length;
  24. while (mm / 1024 > 300) {
  25. if (kk > aa + aa / 10) {
  26. kk -= aa;
  27. if (mm == (int)UIImageJPEGRepresentation(normalImg, kk).length) {
  28. break;
  29. }
  30. mm = (int)UIImageJPEGRepresentation(normalImg, kk).length;
  31. }else{
  32. aa /= 10;
  33. }
  34. }
  35. NSLog(@"KK:%f -- aa:%f",kk,aa);
  36. #warning 图片压缩
  37. NSLog(@"第二次处理后:with-----%f height-----%f",normalImg.size.width, normalImg.size.height);
  38. NSData *newData;
  39. newData = UIImageJPEGRepresentation(normalImg, kk);//最后压缩结果
  40. if (newData.length/1024 > 300) {
  41. [APPRequest showAlert:@"提示" message:@"图片过大"];
  42. }else{
  43. // 上传图片网络请求
  44. }
  45. }];
  46. }
  47. }

2.发布时间

  1. NSDate *  timeDate = [NSDate date];
  2. NSTimeInterval nowInt = [timeDate timeIntervalSince1970]*1;
  3. NSDateFormatter  *dateformatter=[[NSDateFormatter alloc] init];
  4. [dateformatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
  5. NSDate* publishDate = [dateformatter dateFromString:[demandlist.publish_time substringToIndex:19]];
  6. NSTimeInterval publishInt = [publishDate timeIntervalSince1970]*1;
  7. NSTimeInterval cha = nowInt - publishInt;
  8. NSString *timeString=@"";
  9. if (cha/3600<1) {
  10. timeString = [NSString stringWithFormat:@"%f", cha/60];
  11. timeString = [timeString substringToIndex:timeString.length-7];
  12. timeString = [NSString stringWithFormat:@"%@分钟前发布", timeString];
  13. }
  14. if (cha/3600>1&&cha/86400<1) {
  15. timeString = [NSString stringWithFormat:@"%f", cha/3600];
  16. timeString = [timeString substringToIndex:timeString.length-7];
  17. timeString = [NSString stringWithFormat:@"%@小时前发布", timeString];
  18. }
  19. if (cha/86400>1)
  20. {
  21. timeString = [NSString stringWithFormat:@"%f", cha/86400];
  22. timeString = [timeString substringToIndex:timeString.length-7];
  23. timeString = [NSString stringWithFormat:@"%@天前发布", timeString];
  24. }

3.返回字符串所占的尺寸

  1. //返回字符串所占用的尺寸.
  2. -(CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize
  3. {    NSDictionary *attrs = @{NSFontAttributeName : font};
  4. return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
  5. }

4.tableView自动滑倒某一行

  1. NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:10 inSection:0];
  2. [[self tableView] scrollToRowAtIndexPath:scrollIndexPath
  3. atScrollPosition:UITableViewScrollPositionTop animated:YES];

5.tableView刷新某个分区或某行

  1. NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];
  2. [tableview reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
  3. //一个cell刷新
  4. NSIndexPath *indexPath=[NSIndexPath indexPathForRow:3 inSection:0];
  5. [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone]; <span style="font-family: Arial, Helvetica, sans-serif;"> </span>

6.读取plist文件

  1. NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"plistdemo" ofType:@"plist"];
  2. NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];

7.关键字高亮

  1. label.text = [NSString stringWithFormat:@" 视野头条:%@",home.title];
  2. NSString *str = [NSString stringWithFormat:@" 视野头条:%@",home.title];
  3. NSMutableAttributedString *titleStr = [[NSMutableAttributedString alloc]initWithString:str];
  4. NSRange range = [str rangeOfString:@"视野头条:"];
  5. [titleStr addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:range];
  6. [label setAttributedText:titleStr];

8.去掉字符串中的空格

  1. NSString *str = @"dhak d sh akdl ";
  2. NSString *strUrl = [str stringByReplacingOccurrencesOfString:@" " withString:@""];

9.UIImage添加生成圆角图片的扩展API

  1. 给UIImage添加生成圆角图片的扩展API:
  2. - (UIImage *)imageWithCornerRadius:(CGFloat)radius {
  3. CGRect rect = (CGRect){0.f, 0.f, self.size};
  4. UIGraphicsBeginImageContextWithOptions(self.size, NO, UIScreen.mainScreen.scale);
  5. CGContextAddPath(UIGraphicsGetCurrentContext(),
  6. [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:radius].CGPath);
  7. CGContextClip(UIGraphicsGetCurrentContext());
  8. [self drawInRect:rect];
  9. UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
  10. UIGraphicsEndImageContext();
  11. return image;
  12. }
  13. //然后调用时就直接传一个圆角来处理:
  14. imgView.image = [[UIImage imageNamed:@"test"] hyb_imageWithCornerRadius:4];
  15. //最直接的方法就是使用如下属性设置:
  16. imgView.layer.cornerRadius = 10;
  17. // 这一行代码是很消耗性能的
  18. imgView.clipsToBounds = YES;
  19. //
    好处是使用简单,操作方便。坏处是离屏渲染(off-screen-rendering)需要消耗性能。对于图片比较多的视图上,不建议使用这种方法来设
    置圆角。通常来说,计算机系统中CPU、GPU、显示器是协同工作的。CPU计算好显示内容提交到GPU,GPU渲染完成后将渲染结果放入帧缓冲区。
  20. //简单来说,离屏渲染,导致本该GPU干的活,结果交给了CPU来干,而CPU又不擅长GPU干的活,于是拖慢了UI层的FPS(数据帧率),并且离屏需要创建新的缓冲区和上下文切换,因此消耗较大的性能。

10.正则法则

  1. //1.验证邮箱
  2. + (BOOL)validateEmail:(NSString *)email
  3. {
  4. NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
  5. NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
  6. return [emailTest evaluateWithObject:email];
  7. }
  8. //2.验证手机(简单的)
  9. + (BOOL)validatePhone:(NSString *)phone
  10. {
  11. NSString *phoneRegex = @"1[3|5|7|8|][0-9]{9}";
  12. NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
  13. return [phoneTest evaluateWithObject:phone];
  14. }
  15. //验证手机(复杂的)
  16. + (BOOL)validatePhone:(NSString *)phone
  17. {
  18. /**
  19. * 手机号码
  20. * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
  21. * 联通:130,131,132,152,155,156,185,186
  22. * 电信:133,1349,153,180,189
  23. */
  24. NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$";
  25. /**
  26. 10         * 中国移动:China Mobile
  27. 11         * 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
  28. 12         */
  29. NSString * CM = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\\d)\\d{7}$";
  30. /**
  31. 15         * 中国联通:China Unicom
  32. 16         * 130,131,132,152,155,156,185,186
  33. 17         */
  34. NSString * CU = @"^1(3[0-2]|5[256]|8[56])\\d{8}$";
  35. /**
  36. 20         * 中国电信:China Telecom
  37. 21         * 133,1349,153,180,189
  38. 22         */
  39. NSString * CT = @"^1((33|53|8[09])[0-9]|349)\\d{7}$";
  40. /**
  41. 25         * 大陆地区固话及小灵通
  42. 26         * 区号:010,020,021,022,023,024,025,027,028,029
  43. 27         * 号码:七位或八位
  44. 28         */
  45. // NSString * PHS = @"^0(10|2[0-5789]|\\d{3})\\d{7,8}$";
  46. NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE];
  47. NSPredicate *regextestcm = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CM];
  48. NSPredicate *regextestcu = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CU];
  49. NSPredicate *regextestct = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CT];
  50. if (([regextestmobile evaluateWithObject:phone] == YES)
  51. || ([regextestcm evaluateWithObject:phone] == YES)
  52. || ([regextestct evaluateWithObject:phone] == YES)
  53. || ([regextestcu evaluateWithObject:phone] == YES))
  54. {
  55. if([regextestcm evaluateWithObject:phone] == YES) {
  56. NSLog(@"China Mobile");
  57. } else if([regextestct evaluateWithObject:phone] == YES) {
  58. NSLog(@"China Telecom");
  59. } else if ([regextestcu evaluateWithObject:phone] == YES) {
  60. NSLog(@"China Unicom");
  61. } else {
  62. NSLog(@"Unknow");
  63. }
  64. return YES;
  65. }
  66. else
  67. {
  68. return NO;
  69. }
  70. }

11.清除缓存

  1. // 删除缓存
  2. - (void)removeCache
  3. {
  4. NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
  5. NSLog(@"%@",cachePath);
  6. NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:cachePath];
  7. for (NSString *p in files) {
  8. NSString *path = [NSString stringWithFormat:@"%@/%@", cachePath, p];
  9. if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
  10. [[NSFileManager defaultManager] removeItemAtPath:path error:nil];
  11. }
  12. }
  13. }
  14. // 计算清除的缓存大小
  15. - (CGFloat)floatWithPath:(NSString *)path
  16. {
  17. CGFloat num = 0;
  18. NSFileManager *man = [NSFileManager defaultManager];
  19. if ([man fileExistsAtPath:path]) {
  20. NSEnumerator *childFile = [[man subpathsAtPath:path] objectEnumerator];
  21. NSString *fileName;
  22. while ((fileName = [childFile nextObject]) != nil) {
  23. NSString *fileSub = [path stringByAppendingPathComponent:fileName];
  24. num += [self fileSizeAtPath:fileSub];
  25. }
  26. }
  27. return num / (1024.0 * 1024.0);
  28. }
  29. //计算单个文件大小
  30. - (long long)fileSizeAtPath:(NSString *)file
  31. {
  32. NSFileManager *man = [NSFileManager defaultManager];
  33. if ([man fileExistsAtPath:file]) {
  34. return [[man attributesOfItemAtPath:file error:nil] fileSize];
  35. }
  36. return 0;
  37. }

12 系统原生态二维码扫描(包括闪光灯,系统提示音)

  1. #import <AVFoundation/AVFoundation.h>
  2. #import <AudioToolbox/AudioToolbox.h> // 系统提示音
  3. #define SCANVIEW_EdgeTop 40.0
  4. #define SCANVIEW_EdgeLeft 50.0
  5. #define TINTCOLOR_ALPHA 0.2 //浅色透明度
  6. #define DARKCOLOR_ALPHA 0.5 //深色透明度
  7. #define VIEW_WIDTH [UIScreen mainScreen].bounds.size.width
  8. #define VIEW_HEIGHT [UIScreen mainScreen].bounds.size.height
  9. /*
  10. *********注意 :系统原生态二维码扫描 苹果官方目前不支持扫扫描图册图片 ************
  11. 1.第一步 引入框架 AVFoundation.framework
  12. 2.第二步 声明代理:AVCaptureMetadataOutputObjectsDelegate 。 define 几个东东用来画框、画线:
  13. */
  14. @interface ViewController ()<AVCaptureMetadataOutputObjectsDelegate>
  15. {
  16. AVCaptureSession * session;//输入输出的中间桥梁
  17. UIView *AVCapView;//此 view 用来放置扫描框、取消按钮、说明 label
  18. UIView *_QrCodeline;//上下移动绿色的线条
  19. NSTimer *_timer;
  20. }
  21. @end
  22. @implementation ViewController
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. [self createUI];
  26. // Do any additional setup after loading the view, typically from a nib.
  27. }
  28. #pragma mark 4.在某个方法中(我是点击扫描按钮)创建扫描界面,开始扫描
  29. - (void)createUI{
  30. //创建一个 view 来放置扫描区域、说明 label、取消按钮
  31. UIView *tempView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, [UIScreen mainScreen].bounds.size.height )];
  32. AVCapView = tempView;
  33. AVCapView.backgroundColor = [UIColor colorWithRed:54.f/255 green:53.f/255 blue:58.f/255 alpha:1];
  34. UIButton *cancelBtn = [[UIButton alloc]initWithFrame:CGRectMake(15, [UIScreen mainScreen].bounds.size.height - 100, 50, 25)];
  35. UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(15, 268, 290, 60)];
  36. label.numberOfLines = 0;
  37. label.text = @"小提示:将条形码或二维码对准上方区域中心即可";
  38. label.textColor = [UIColor grayColor];
  39. [cancelBtn setTitle:@"取消" forState: UIControlStateNormal];
  40. [cancelBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
  41. [cancelBtn addTarget:self action:@selector(touchAVCancelBtn) forControlEvents:UIControlEventTouchUpInside];
  42. [AVCapView addSubview:label];
  43. [AVCapView addSubview:cancelBtn];
  44. [self.view addSubview:AVCapView];
  45. //画上边框
  46. UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(SCANVIEW_EdgeLeft, SCANVIEW_EdgeTop, VIEW_WIDTH- 22 * SCANVIEW_EdgeLeft, 1)];
  47. topView.backgroundColor = [UIColor whiteColor];
  48. [AVCapView addSubview:topView];
  49. //画左边框
  50. UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(SCANVIEW_EdgeLeft, SCANVIEW_EdgeTop , 1,VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft )];
  51. leftView.backgroundColor = [UIColor whiteColor];
  52. [AVCapView addSubview:leftView];
  53. //画右边框
  54. UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(SCANVIEW_EdgeLeft + VIEW_WIDTH- 22 * SCANVIEW_EdgeLeft, SCANVIEW_EdgeTop , 1,VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft + 1)];
  55. rightView.backgroundColor = [UIColor whiteColor];
  56. [AVCapView addSubview:rightView];
  57. //画下边框
  58. UIView *downView = [[UIView alloc] initWithFrame:CGRectMake(SCANVIEW_EdgeLeft, SCANVIEW_EdgeTop + VIEW_WIDTH- 22 * SCANVIEW_EdgeLeft,VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft ,1 )];
  59. downView.backgroundColor = [UIColor whiteColor];
  60. [AVCapView addSubview:downView];
  61. //闪光灯
  62. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  63. btn.frame = CGRectMake(150, [UIScreen mainScreen].bounds.size.height - 100, 80, 35);
  64. [btn setTintColor:[UIColor grayColor]];
  65. [btn setTitle:@"闪光灯" forState:UIControlStateNormal];
  66. [btn addTarget:self action: @selector(OPEN:) forControlEvents:UIControlEventTouchUpInside];
  67. [AVCapView  addSubview:btn];
  68. //画中间的基准线
  69. _QrCodeline = [[UIView alloc] initWithFrame:CGRectMake(SCANVIEW_EdgeLeft + 1, SCANVIEW_EdgeTop, VIEW_WIDTH- 22 * SCANVIEW_EdgeLeft - 1, 2)];
  70. _QrCodeline.backgroundColor = [UIColor greenColor];
  71. [AVCapView addSubview:_QrCodeline];
  72. // 先让基准线运动一次,避免定时器的时差
  73. [UIView animateWithDuration:1.2 animations:^{
  74. _QrCodeline.frame = CGRectMake(SCANVIEW_EdgeLeft + 1, VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft + SCANVIEW_EdgeTop , VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft - 1, 2);
  75. }];
  76. [self performSelector:@selector(createTimer) withObject:nil afterDelay:0.4];
  77. AVCaptureDevice * device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
  78. //创建输入流
  79. AVCaptureDeviceInput * input = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil];
  80. //创建输出流
  81. AVCaptureMetadataOutput * output = [[AVCaptureMetadataOutput alloc]init];
  82. //设置代理 在主线程里刷新
  83. [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
  84. //初始化链接对象
  85. session = [[AVCaptureSession alloc]init];
  86. //高质量采集率
  87. [session setSessionPreset:AVCaptureSessionPresetHigh];
  88. [session addInput:input];
  89. [session addOutput:output];
  90. //设置扫码支持的编码格式(如下设置条形码和二维码兼容)
  91. output.metadataObjectTypes=@[AVMetadataObjectTypeQRCode,AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode128Code];
  92. AVCaptureVideoPreviewLayer * layer = [AVCaptureVideoPreviewLayer layerWithSession:session];
  93. layer.videoGravity=AVLayerVideoGravityResizeAspectFill;
  94. layer.frame = CGRectMake(SCANVIEW_EdgeLeft, SCANVIEW_EdgeTop, VIEW_WIDTH- 22 * SCANVIEW_EdgeLeft, 220);
  95. [AVCapView.layer insertSublayer:layer atIndex:0];
  96. //开始捕获
  97. [session startRunning];
  98. }
  99. #pragma mark 调用闪光灯
  100. - (void)OPEN:(UIButton *)btn{
  101. btn.selected = !btn.isSelected;
  102. AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
  103. if ([device hasTorch]) {
  104. [device lockForConfiguration:nil];
  105. if (btn.selected) {
  106. [device setTorchMode:AVCaptureTorchModeOn];
  107. }else{
  108. [device setTorchMode:AVCaptureTorchModeOff];
  109. }
  110. [device unlockForConfiguration];
  111. }
  112. }
  113. - (void)touchAVCancelBtn{
  114. //取消按钮的响应时间
  115. }
  116. #pragma mark 5.实现定时器、还有基准线的滚动方法
  117. - (void)createTimer
  118. {
  119. _timer=[NSTimer scheduledTimerWithTimeInterval:1.1 target:self selector:@selector(moveUpAndDownLine) userInfo:nil repeats:YES];
  120. }
  121. - (void)stopTimer
  122. {
  123. if ([_timer isValid] == YES) {
  124. [_timer invalidate];
  125. _timer = nil;
  126. }
  127. }
  128. // 滚来滚去 :D :D :D
  129. - (void)moveUpAndDownLine
  130. {
  131. CGFloat YY = _QrCodeline.frame.origin.y;
  132. if (YY != VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft + SCANVIEW_EdgeTop ) {
  133. [UIView animateWithDuration:1.2 animations:^{
  134. _QrCodeline.frame = CGRectMake(SCANVIEW_EdgeLeft + 1, VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft + SCANVIEW_EdgeTop , VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft - 1,2);
  135. }];
  136. }else {
  137. [UIView animateWithDuration:1.2 animations:^{
  138. _QrCodeline.frame = CGRectMake(SCANVIEW_EdgeLeft + 1, SCANVIEW_EdgeTop, VIEW_WIDTH - 22 * SCANVIEW_EdgeLeft - 1,2);
  139. }];
  140. }
  141. }
  142. #pragma mark 6.扫描成功后,想干嘛干嘛,就在这个代理方法里面实现就行了
  143. -(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection{
  144. if (metadataObjects.count>0) {
  145. //[session stopRunning];
  146. AVMetadataMachineReadableCodeObject * metadataObject = [metadataObjects objectAtIndex : 0 ];
  147. //输出扫描字符串
  148. NSLog(@"%@",metadataObject.stringValue);
  149. AudioServicesPlaySystemSound(1307);
  150. [session stopRunning];
  151. [self stopTimer];
  152. //[AVCapView removeFromSuperview];
  153. }
  154. }

13.webView计算高度

    1. //第一种:
    2. - (void)webViewDidFinishLoad:(UIWebView *)webView{
    3. float height = [[webView stringByEvaluatingJavaScriptFromString:@document.body.offsetHeight;] floatValue];
    4. //document.body.scrollHeight
    5. }
    6. //第二种:
    7. - (void) webViewDidFinishLoad:(UIWebView *)webView
    8. {
    9. CGRect frame = webView.frame;
    10. CGSize fittingSize = [webView sizeThatFits:CGSizeZero];
    11. frame.size = fittingSize;
    12. webView.frame = frame;
    13. }
    14. //另外一种
    15. - (void)viewDidLoad {
    16. [super viewDidLoad];
    17. webview.delegate = self;
    18. [webview loadHTMLString:@
    19. fdasfda
    20. baseURL:nil];
    21. }
    22. - (void)webViewDidFinishLoad:(UIWebView *)webView
    23. {
    24. NSString *output = [webview stringByEvaluatingJavaScriptFromString:@document.getElementByIdx_x_x_x(foo).offsetHeight;];
    25. NSLog(@height: %@, output);
    26. }

iOS开发中一些常用的方法的更多相关文章

  1. iOS开发中的Html解析方法

    iOS开发中的Html解析方法 本文作者为大家介绍了在iOS开发中的Html解析方法,并同时提供了Demo代码的下载链接,Demo 解析了某个网站(具体可在代码中查看)的html网页,提取了图片以及标 ...

  2. iOS开发中的常用宏定义

    在iOS开发的过程中合理的使用宏定义能够极大提高编码的速度,下面是一些常用的宏定义,部分内容来自互联网 Log // 调试状态, 打开LOG功能 #ifdef DEBUG #define GLLog( ...

  3. IOS开发中Xcode常用插件安装与管理(转)

    XCode中插件管理工具:Alcatraz    转自http://www.cocoachina.com/industry/20140506/8325.html 苹果现在的成绩得益于其始终如一的坚持. ...

  4. JS 开发中数组常用的方法

    大家有没有想过,js数组为什么会有这么多的方法,没错,就是为了不同场景下处理数据的需要,就像设计模式一样,都是为了能更好的处理当前场景的需要. 首先怎么创建一个数组呢, // 两种方式 // 1,构造 ...

  5. iOS开发中数组常用的五种遍历方式

    随着iOS的不断发展,apple也不断推出性能更高的数组遍历方式,下面将对熟悉的五种遍历方式进行列举. 首先定义一个数组,并获取数组长度 NSArray *array=@[",]; NSIn ...

  6. ios开发中一些常用API总结

    转载于:http://www.cnblogs.com/zhucunliang/archive/2013/11/09/3416039.html //1.init初始化 NSString * str1 = ...

  7. IOS开发-UITextField代理常用的方法总结

    1.//当用户全部清空的时候的时候 会调用 -(BOOL)textFieldShouldClear:(UITextField *)textField: 2.//可以得到用户输入的字符 -(BOOL)t ...

  8. iOS开发中自定义字体的方法

    http://www.cnblogs.com/iyou/archive/2014/05/25/3751669.html 1. 首先下载你想要设置的字体库,例如设置方正启体简体 2. 添加到工程,一定要 ...

  9. (iOS)开发中收集的小方法

    1.颜色转变成图片 - (UIImage *)createImageWithColor:(UIColor *)color {     CGRect rect = CGRectMake(0.0f, 0. ...

随机推荐

  1. easyui源码翻译1.32--EasyLoader(简单加载)

    前言 扩展自$.fn.datebox.defaults,使用$.fn.datetimebox.defaults重写默认值对象.下载该插件翻译源码 源码 /** * jQuery EasyUI 1.3. ...

  2. cto

    CTO(首席技术官)英文Chief Technology Officer,即企业内负责技术的最高负责人.这个名称在1980年代从美国开始时兴.起于做很多研究的大公司,如General Electric ...

  3. hdu4722Good Numbers(dp)

    链接 这题规律其实挺明显的 打表找规律估计都可以 正规点就是DP 算出第N位所包含的good number的数量 如果给出的数是N+1位 就枚举各位上比原来小的数 加上下一位的dp值 一个i写成g了 ...

  4. PHP 'ext/gd/gd.c' gdImageCrop空指针返回拒绝服务漏洞

    漏洞版本: PHP 5.5.x 漏洞描述: CVE ID:CVE-2013-7327 PHP是一种HTML内嵌式的语言. PHP 'ext/gd/gd.c' gdImageCrop函数没有检查返回值, ...

  5. 如何从Win7中提取制作Windows PE3.0

    在D盘新建文件夹winpe,在winpe中新建sources.pe3和new文件夹,把附件中提供的工具imagex连文件夹一起放到winpe目录中. 制作方法: 1.把windows7光盘(或光盘镜像 ...

  6. Matlab read_grib.r4 安装新方法(转自:http://blog.sina.com.cn/s/blog_9f36648b010179s7.html)

    最近,打算用Matlab处理些GRIB格式的文件,需要在Matlab中添加read_grib.m文件,其实相当于是添加一个工具箱.read_grib.m的下载见:http://www.renci.or ...

  7. FZU 2237 中位数 主席树 树上k大

    #include <cstdio> #include <cstring> #include <queue> #include <set> #includ ...

  8. Robotium 系列(1)

    之前也写过一些blog,可是没什么坚持.这个系列算是对之前工作的一个总结和提高:也与大家共同进步! 本文主要介绍的内容是: 1. 软件测试的基本概念 2. 自动化测试的概念 3. 手动测试和自动化测试 ...

  9. 关于mysql的error-based injection payload

    今天用sqlmap扫一个网站,想得到一个表的所有列名,注意到sqlmap用到的一个error-based payload的: 1 AND (SELECT 3174 FROM(SELECT COUNT( ...

  10. 谈谈以下关键字的作用auto static register const volatile extern

    (1)auto 这个这个关键字用于声明变量的生存期为自动,即将不在任何类.结构.枚举.联合和函数中定义的变量视为全局变量,而在函数中定义的变量视为局部变量.这个关键字不怎么多写,因为所有的变量默认就是 ...