自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(32)
  • 资源 (7)
  • 收藏
  • 关注

原创 页面间旋转跳转

目的:从ViewController 跳转到 AnotherVC 并实现旋转跳转效果在Viewcontroller中实现下面方法。注意:modalTransitionStyle可以设置跳转形式,默认值为UIModalTransitionStyleCoverVertical,只在模态跳转中设置才有效果。/* typedef NS_ENUM(NSInteger, UIMod

2016-01-21 11:06:42 369

原创 限制UITextField输入字数(系统输入法候选输入同样适用)

今天遇到一个输入框需求,输入字数不能超过20。     我首先使用的是UITextField代理方法:- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{if (textField

2016-01-13 11:39:42 340

原创 MBProgressHUD换行显示文字

-(void)showToast:(NSString *)string{    [MBProgressHUDhideAllHUDsForView:self.viewanimated:YES];    AppDelegate *app = (AppDelegate *)[UIApplicationsharedApplication].delegate;    MBProgre

2016-01-11 14:44:21 3981

原创 图片从视图中心移动到左下角渐变消失

-(void)imageAnimation:(UIImageView *)ImageView{    //位置居中    ImageView.center =self.view.center;    //开始    [UIViewbeginAnimations:@"ImageViewAnimation"context:(__bridgevoid * _Nullabl

2016-01-07 11:33:48 393

原创 导航栏标题不居中

解决方法是在上一个页面-(void)viewWillDisappear:(BOOL)animated{    [superviewWillDisappear:animated];    self.title =nil;}

2016-01-05 15:29:22 867

原创 隐藏导航栏页面和不隐藏页面视差处理

在需要隐藏导航栏的页面添加代码-(void)viewWillAppear:(BOOL)animated{    [superviewWillAppear:YES];    [self.navigationControllersetNavigationBarHidden:YESanimated:YES];}-(void)viewWillDisappea

2016-01-05 15:26:28 380

原创 高德地图返回当前定位位置功能

self.mapView.centerCoordinate = self.mapView.userLocation.location.coordinate

2016-01-05 15:24:12 3736

原创 请求参数里面有汉字的处理

NSString *strName = [field.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

2015-12-25 12:50:10 457

原创 记录时间距离现在多久

//调用代码: NSString*dateStr = @"2014-11-10 13:00:13";    NSDateFormatter* dateFormat = [[NSDateFormatteralloc]init];//实例化一个NSDateFormatter对象    [dateFormat setDateFormat:@"yyyy-MM-dd HH

2015-12-25 12:03:36 388

原创 日期加减一天

NSString*dateString = @"2014-09-01";       NSDateFormatter *formatter = [[NSDateFormatteralloc]init];    [formatter setDateFormat:@"yyyy-MM-dd"];    NSDate *date = [formatterda

2015-12-25 12:02:15 390

原创 计算两个经纬度之间的距离

第一种方法:苹果自带的CLLocation *orig=[[[CLLocation alloc] initWithLatitude:[mainDelegate.latitude_self doubleValue]  longitude:[mainDelegate.longitude_self doubleValue]] autorelease];      CLLocation* dist

2015-12-25 11:57:32 339

原创 url 编码和解码

1.url编码ios中http请求遇到汉字的时候,需要转化成UTF-8,用到的方法是:NSString * encodingString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];2.url解码请求后,返回的数据,如何显示的是这样的格式:%3A%2F%2F

2015-12-25 11:56:37 246

原创 打印宏定义

#define NSLog(s, ...) NSLog(@"DEBUG %s(%d): %@", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])

2015-12-25 11:55:34 404

原创 url链接直接获取UIImage方法

-(UIImage*) getImageFromURL:(NSString*)fileURL {    UIImage * result;    NSData * data = [NSDatadataWithContentsOfURL:[NSURLURLWithString:fileURL]];    result = [UIImageimageWithDa

2015-12-25 11:54:22 591

原创 UIButton的titleEdgeInsets和imageEdgeInse

注意:当一个按钮上既有文字又有图标时,可以用于调整文字和图标的位置。btn.frame = CGRectMake(_label1.frame.origin.x+_label1.frame.size.width+10,_label1.frame.origin.y+40*i,90, 25);                btn.titleEdgeInsets = UIEdgeInsetsMa

2015-12-25 11:52:34 238

原创 UILabel的行间距

实现代码:contentLabel2.text = @"1、代金优惠券为全场通用礼券,每个订单限使用一张优惠券;\n2、满200元可使用5元优惠券,满300元可使用10元优惠券,满500元可使用20元优惠券,满1200元可使用50元优惠券(不可叠加使用);\n3、代金优惠券不能用于页面提示的特例产品\n4、请注意优惠券使用期限,逾期作废.";  

2015-12-25 11:51:21 248

原创 返回时列表视图回复到起始位置

[integrationTable setContentOffset:CGPointMake(0, 0) animated:YES];//返回时列表视图回复到起始位置

2015-12-25 11:50:02 256

原创 给label添加删除线

NSUInteger length = [cell.marketPriceLabel.textlength];    NSMutableAttributedString*attri = [[NSMutableAttributedStringalloc]initWithString:cell.marketPriceLabel.text];    [attri addAtt

2015-12-25 11:48:40 401

原创 获取当前屏幕显示的viewcontroller

- (UIViewController *)getCurrentVC{    UIViewController *currentVC = nil;       UIWindow * window = [[UIApplication sharedApplication] keyWindow];       if (window.windowLevel != UIWindowL

2015-12-25 11:46:51 240

原创 MBProgressHUD提示显示在最表层

AppDelegate*app = (AppDelegate*)[UIApplicationsharedApplication].delegate;    MBProgressHUD *hud = [MBProgressHUDshowHUDAddedTo:app.windowanimated:YES];

2015-12-25 11:46:13 708

原创 present出来的页面push到其他页面

// push的目标页面:HSSearchArtistsViewControllerHSSearchArtistsViewController *search = [[HSSearchArtistsViewController alloc]init];    UINavigationController *navigationController = [[UINavigationContr

2015-12-25 11:45:28 1175

原创 区分字符串中得字母和汉字

for (int i = 0; i             unichar c = [strs characterAtIndex:i];            if (c >=0x4E00 && c             {                NSLog(@"汉字");               }else{                NSLog(@"英

2015-12-25 11:43:19 462

原创 从Appdelegate传值到其他页面

1.由于Appdelegate是单例所以,先在Appdelegate中把要传递的值声明为属性。@property (nonatomic,retain) NSDictionary *kitData;2.在需要传真的页面创建Appdelegate单例对象AppDelegate_jianke *delegate = [UIApplication sharedApplication].de

2015-12-25 11:42:04 769

原创 调用第三方应用导航

#pragma mark创建actionSheet-(void)navigationCompletion:(NSNotification*)notification {    //接受notification的userInfo,可以把参数存进此变量    NSDictionary *theData = [notificationuserInfo];    N

2015-12-25 11:37:39 389

原创 Appdelegate里面跳转页面

分析:(a)如果程序没有在后台运行 而是彻底退出的时候 点击推送消息进入应用,这个方法的launchOptions 会有值http://www.th7.cn/Program/IOS/201503/417096.shtml NSDictionary * userInfo = [launchOptions objectForKey:UIApplicationLaunchOpti

2015-12-25 11:32:45 938

原创 url链接解析成参数字典方法

+(NSMutableDictionary *)dealWithUrlStr:(NSString *)UrlStr{    NSMutableDictionary *resultDict = [NSMutableDictionary dictionary];    NSRange rangeOne = [UrlStr rangeOfString:@"?"];    NSRange ra

2015-12-25 11:13:23 565

原创 FMDB存储字典或数组

储,你查询获取数据时就会获取无法转换成字典或数组的字符串。转换JSON存储:NSArray *picArr = (NSArray *)dic[@"pic"];        NSError *err = nil;        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:picArroptions:NSJ

2015-12-25 11:10:18 2320

原创 跳转到该应用在系统中的设置页面

NSURL*url = [NSURLURLWithString:UIApplicationOpenSettingsURLString];        if ([[UIApplicationsharedApplication]canOpenURL:url]) {            [[UIApplicationsharedApplication]openUR

2015-12-25 11:08:22 293

原创 上传本地项目到github

第一步:创建新repository第二步:复制ssh地址,然后是从头部的Source Control->Configure xxDemo->Remotes->’+’号->Add Remote..,最后在Address栏里面填写ssh地址、填写github账户,就可以push代码到github上面

2015-12-25 10:56:16 242

原创 APPstore上架问题 ERROR ITMS-90096

上架问题:问题1:ERROR ITMS-90096ERROR ITMS-90096:”Your binary is not optimized for iphone 5 - New iPhone apps and app updates submitted must support the 4-inch display on iPhone 5 and must include a laun

2015-12-25 10:54:02 1395

原创 信用卡绑定(BrainTree)

//BrainTree ioshttps://developers.braintreepayments.com/start/hello-client/ios/v4/** *  获取payment-method-once参数 */-(void)getPaymentMethodOnceWithClientToken:(NSString*)ClientToken{

2015-12-25 10:52:34 1445 1

原创 仿安卓UITableview 预加载数据

//每次预加载成功后  _index+= RowNumber;-(void)scrollViewDidScroll:(UIScrollView*)scrollView{   if (scrollView == self.performaceTable) {        NSIndexPath *path =  [self.performaceTable

2015-12-25 10:50:11 1737

HomeKit 开发指南 - v1.0

HomeKit 开发指南 - v1.0

2015-12-30

The Swift Programming Language 中文版 - v1.2

The Swift Programming Language 中文版 - v1.2

2015-12-30

广告轮播控件

广告轮播控件,调用简单。 调用方法: NSArray *images = @[@"zoro.jpg",@"three.jpg",@"onepiece.jpg"]; WMLoopView *loopView = [[WMLoopView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width/1.8) images:images autoPlay:YES delay:10.0]; loopView.delegate = self; self.tableView.tableHeaderView = loopView;

2015-12-25

UIColor+JKUI颜色转化

UIColor+JKUI颜色转化,可转换#fffff类型色值,调用方便。 btn.tintColor = [UIColor jk_colorWithHexString:redTextColor];

2015-12-25

JKLoading封装loading类型

JKLoading封装loading类型,调用简单。 开启动画: [[Loading shareLoading] startLoading]; 关闭动画: [[Loading shareLoading] stopLoading];

2015-12-25

判断设备型号(最新到iphone6s)

判断设备型号(最新到iphone6s)

2015-12-25

本地存储NSUserdefault封装(可存储各种类型)

本地存储NSUserdefault封装(可存储各种类型),简单易用。 调用方法: #import "ViewController.h" #import "StudentModel.h" #import "InfoModel.h" #import "NSObject+JKLocalStore.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; StudentModel *student = [[StudentModel alloc] init]; student.name = @"A"; NSArray *array = @[[InfoModel new], [InfoModel new], [InfoModel new]]; student.datas = array; [student localStoreWithKey:@"FastCoding"]; StudentModel *tmpStudent = [StudentModel valueWithKey:@"FastCoding"]; NSLog(@"%@", tmpStudent.name); NSLog(@"%@", tmpStudent.datas); }

2015-12-25

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除