- 博客(25)
- 资源 (1)
- 收藏
- 关注
原创 GCD的基本用法
1、DISPATCH_QUEUE_SERIAL 每次运行一个任务,可以添加多个,执行次序FIFO. dispatch_async(myQueue, ^{ [NSThread sleepForTimeInterval:6]; NSLog(@"[NSThread sleepForTimeInterval:6];"); });
2016-02-03 17:57:09
597
原创 自定义TabBar
1、MyTabBarViewController.m#import "MyTabBarViewController.h"#import "XNTabBar.h"@interface MyTabBarViewController ()@end@implementation MyTabBarViewController- (void)viewDidLoad {
2016-02-03 16:23:43
227
原创 javaScript 与OC方法的调用
1、在UIWebView的浏览器的JavaScript中, 没有相关的接口可以调用Objective-C的相关方法. 一般采用JavaScript 在浏览器环境中发出URL请求, Objective-C 截获请 求以获取相关请求的思路.在Objective-C 中在实现UIWebViewDelegate ,然后回调UIWebview的-(BOOL)webView:(UIWebView *)
2016-01-29 11:01:56
522
原创 动态计算高度
NSString *titleText = model.name; UIFont *titleFont = [UIFont fontWithName:FONT_FZLTH size:30*SCALE_RATIO]; CGSize size = CGSizeMake(SCREEN_WIDTH - 40, 400);//设置行高上限 NSDictionary *textD
2016-01-27 14:49:15
306
原创 使用GCD创建单例
+(UIManager *)sharedInstance { static UIManager *sharedInstance = nil; static dispatch_once_t oncePredicate; dispatch_once (&oncePredicate, ^{ if(sharedInstance == nil){ sharedIn
2016-01-27 10:07:49
251
原创 在Appdelegate中获取当前的ViewController
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController; UINavigationController *navController = tabBarController.selectedViewController;
2016-01-14 18:52:53
3435
原创 改变图片的饱和度、亮度、对比度
- (void)viewDidLoad { [super viewDidLoad]; UIImage *image = [UIImage imageNamed:@"默认@2x"]; CIImage *beginImage = [CIImage imageWithCGImage:image.CGImage]; CIFilter *filter = [CIF
2016-01-04 15:51:34
1625
原创 调整屏幕亮度的方法
在iOS5.0以下,在程序中是不能直接设置系统屏幕亮度的,到了ios5.0以后将这个api开放给了开发者,这样我们就可以非常方更的更改系统屏幕的亮度,@property(nonatomic) CGFloat brightness NS_AVAILABLE_IOS(5_0); //0 .. 1.0, where 1.0 is maximum brightness. Only sup
2016-01-04 15:34:58
422
原创 uilabel 字体倾斜
NSDictionary *attrDict = @{NSObliquenessAttributeName: @(0.2)}; titleLabel.attributedText = [[NSAttributedString alloc] initWithString:@"热门活动" attributes:attrDict];NSObliquenessAttribut
2015-12-07 11:48:38
394
原创 ios 轻量级 数据的缓存
1、解析网路时将字典保存到NSUserDefaults[[NSUserDefaults standardUserDefaults] setObject:dic forKey:@"homeAdGroup"]; [[NSUserDefaults standardUserDefaults] synchronize];2、在viewdidload 方法中NSDictionary *h
2015-11-21 17:44:49
278
原创 在字符串中提取数字
- (void)viewDidLoad { [super viewDidLoad]; NSString *str = @"98741235你好"; NSScanner *scanner = [NSScanner scannerWithString:str]; [scanner scanUpToCharactersFromSet:[NSCharacterSet
2015-10-23 19:22:36
326
转载 根据屏幕判断设备型号
CGSize screenSize = [UIScreen mainScreen].bounds.size;// 如果是iPhoneif ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { // 竖屏情况 if (screenSize.height > screenSize
2015-10-23 14:53:20
294
转载 关于扫一扫
转载自:http://www.chinatarena.com/Html/iospeixun/201301/3985.html当开发IOS程序中需要用到二维码识别功能的时候,zbar这个开源库估计会被不少人选择。但是关于zbar的用法,网上的资料大部分都集中在ZBarReaderViewController这个类的使用上。达内IOS培训老师在使用中,发现ZBarReaderViewCon
2015-10-20 20:41:29
394
原创 扫一扫 两种方式
//// ScanViewController.m// deji//// Created by 张鹤 on 15/10/20.// Copyright © 2015年 angww. All rights reserved.//#import "ScanViewController.h"#import "ZBarSDK.h"#import "AppDe
2015-10-20 20:23:49
461
1
原创 uiTableView 默认选中并加载数据
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:3 inSection:0]; //默认选中的行数 [_floorTableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];//跳转到选中的cel
2015-10-17 12:34:08
247
原创 我的
//// CouponsViewController.m// deji//// Created by 张鹤 on 15/10/16.// Copyright © 2015年 angww. All rights reserved.//#import "CouponsViewController.h"#import "CouponsModel.h"#im
2015-10-16 21:01:50
293
原创 项目
//// ShopOnFloorViewController.m// deji//// Created by 马杰 on 15/10/7.// Copyright © 2015年 angww. All rights reserved.//#import "ShopOnFloorViewController.h"#import "sysConfig.h
2015-10-16 20:52:18
232
原创 webView2
//// ActivityWebViewController.m// deji//// Created by 张鹤 on 15/10/14.// Copyright © 2015年 angww. All rights reserved.//#import "ActivityWebViewController.h"@interface Activity
2015-10-15 20:59:31
793
原创 WebView与IOS
//// ActivityWebViewController.h// deji//// Created by 张鹤 on 15/10/14.// Copyright © 2015年 angww. All rights reserved.//#import "BaseViewController.h"#define loadingMethodLoc
2015-10-15 20:58:51
264
原创 计算状态栏和导航条的高度
// 状态栏(statusbar) CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame]; NSLog(@"status width - %f", rectStatus.size.width); // 宽度 NSLog(@"status height - %f", rectStat
2015-10-13 19:40:35
329
原创 根据字体数量和字体的型号 动态计算Label的高度
NSString *text = @"askdasfniuqwehnfunujgbnuyqbafyuhgbyusadfhbgvyhwreqwf"; _myLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 23, 175, 33)]; [_myLabel setFont:[UIFont fontWithNa
2015-10-13 15:39:26
305
原创 数字字符串转时间
NSString *startTime = self.model.startDate; NSDateFormatter *startFormatter = [[NSDateFormatter alloc] init]; [startFormatter setDateStyle:NSDateFormatterMediumStyle]; [startFormatter s
2015-10-13 10:30:07
302
原创 获取IOS设备的代码
- (void)viewDidLoad { [super viewDidLoad]; NSString *systemName = [[UIDevice currentDevice] systemName]; NSString *systemVersion = [[UIDevice currentDevice] systemVersion];//os v
2015-10-13 10:28:37
406
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人