- 博客(32)
- 资源 (7)
- 收藏
- 关注
原创 页面间旋转跳转
目的:从ViewController 跳转到 AnotherVC 并实现旋转跳转效果在Viewcontroller中实现下面方法。注意:modalTransitionStyle可以设置跳转形式,默认值为UIModalTransitionStyleCoverVertical,只在模态跳转中设置才有效果。/* typedef NS_ENUM(NSInteger, UIMod
2016-01-21 11:06:42 382
原创 限制UITextField输入字数(系统输入法候选输入同样适用)
今天遇到一个输入框需求,输入字数不能超过20。 我首先使用的是UITextField代理方法:- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{if (textField
2016-01-13 11:39:42 350
原创 MBProgressHUD换行显示文字
-(void)showToast:(NSString *)string{ [MBProgressHUDhideAllHUDsForView:self.viewanimated:YES]; AppDelegate *app = (AppDelegate *)[UIApplicationsharedApplication].delegate; MBProgre
2016-01-11 14:44:21 4000
原创 图片从视图中心移动到左下角渐变消失
-(void)imageAnimation:(UIImageView *)ImageView{ //位置居中 ImageView.center =self.view.center; //开始 [UIViewbeginAnimations:@"ImageViewAnimation"context:(__bridgevoid * _Nullabl
2016-01-07 11:33:48 403
原创 导航栏标题不居中
解决方法是在上一个页面-(void)viewWillDisappear:(BOOL)animated{ [superviewWillDisappear:animated]; self.title =nil;}
2016-01-05 15:29:22 889
原创 隐藏导航栏页面和不隐藏页面视差处理
在需要隐藏导航栏的页面添加代码-(void)viewWillAppear:(BOOL)animated{ [superviewWillAppear:YES]; [self.navigationControllersetNavigationBarHidden:YESanimated:YES];}-(void)viewWillDisappea
2016-01-05 15:26:28 389
原创 高德地图返回当前定位位置功能
self.mapView.centerCoordinate = self.mapView.userLocation.location.coordinate
2016-01-05 15:24:12 3790
原创 请求参数里面有汉字的处理
NSString *strName = [field.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
2015-12-25 12:50:10 468
原创 记录时间距离现在多久
//调用代码: 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 400
原创 日期加减一天
NSString*dateString = @"2014-09-01"; NSDateFormatter *formatter = [[NSDateFormatteralloc]init]; [formatter setDateFormat:@"yyyy-MM-dd"]; NSDate *date = [formatterda
2015-12-25 12:02:15 417
原创 计算两个经纬度之间的距离
第一种方法:苹果自带的CLLocation *orig=[[[CLLocation alloc] initWithLatitude:[mainDelegate.latitude_self doubleValue] longitude:[mainDelegate.longitude_self doubleValue]] autorelease]; CLLocation* dist
2015-12-25 11:57:32 360
原创 url 编码和解码
1.url编码ios中http请求遇到汉字的时候,需要转化成UTF-8,用到的方法是:NSString * encodingString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];2.url解码请求后,返回的数据,如何显示的是这样的格式:%3A%2F%2F
2015-12-25 11:56:37 268
原创 打印宏定义
#define NSLog(s, ...) NSLog(@"DEBUG %s(%d): %@", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])
2015-12-25 11:55:34 415
原创 url链接直接获取UIImage方法
-(UIImage*) getImageFromURL:(NSString*)fileURL { UIImage * result; NSData * data = [NSDatadataWithContentsOfURL:[NSURLURLWithString:fileURL]]; result = [UIImageimageWithDa
2015-12-25 11:54:22 614
原创 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 243
原创 UILabel的行间距
实现代码:contentLabel2.text = @"1、代金优惠券为全场通用礼券,每个订单限使用一张优惠券;\n2、满200元可使用5元优惠券,满300元可使用10元优惠券,满500元可使用20元优惠券,满1200元可使用50元优惠券(不可叠加使用);\n3、代金优惠券不能用于页面提示的特例产品\n4、请注意优惠券使用期限,逾期作废.";
2015-12-25 11:51:21 260
原创 返回时列表视图回复到起始位置
[integrationTable setContentOffset:CGPointMake(0, 0) animated:YES];//返回时列表视图回复到起始位置
2015-12-25 11:50:02 265
原创 给label添加删除线
NSUInteger length = [cell.marketPriceLabel.textlength]; NSMutableAttributedString*attri = [[NSMutableAttributedStringalloc]initWithString:cell.marketPriceLabel.text]; [attri addAtt
2015-12-25 11:48:40 416
原创 获取当前屏幕显示的viewcontroller
- (UIViewController *)getCurrentVC{ UIViewController *currentVC = nil; UIWindow * window = [[UIApplication sharedApplication] keyWindow]; if (window.windowLevel != UIWindowL
2015-12-25 11:46:51 252
原创 MBProgressHUD提示显示在最表层
AppDelegate*app = (AppDelegate*)[UIApplicationsharedApplication].delegate; MBProgressHUD *hud = [MBProgressHUDshowHUDAddedTo:app.windowanimated:YES];
2015-12-25 11:46:13 730
原创 present出来的页面push到其他页面
// push的目标页面:HSSearchArtistsViewControllerHSSearchArtistsViewController *search = [[HSSearchArtistsViewController alloc]init]; UINavigationController *navigationController = [[UINavigationContr
2015-12-25 11:45:28 1199
原创 区分字符串中得字母和汉字
for (int i = 0; i unichar c = [strs characterAtIndex:i]; if (c >=0x4E00 && c { NSLog(@"汉字"); }else{ NSLog(@"英
2015-12-25 11:43:19 472
原创 从Appdelegate传值到其他页面
1.由于Appdelegate是单例所以,先在Appdelegate中把要传递的值声明为属性。@property (nonatomic,retain) NSDictionary *kitData;2.在需要传真的页面创建Appdelegate单例对象AppDelegate_jianke *delegate = [UIApplication sharedApplication].de
2015-12-25 11:42:04 785
原创 调用第三方应用导航
#pragma mark创建actionSheet-(void)navigationCompletion:(NSNotification*)notification { //接受notification的userInfo,可以把参数存进此变量 NSDictionary *theData = [notificationuserInfo]; N
2015-12-25 11:37:39 404
原创 Appdelegate里面跳转页面
分析:(a)如果程序没有在后台运行 而是彻底退出的时候 点击推送消息进入应用,这个方法的launchOptions 会有值http://www.th7.cn/Program/IOS/201503/417096.shtml NSDictionary * userInfo = [launchOptions objectForKey:UIApplicationLaunchOpti
2015-12-25 11:32:45 955
原创 url链接解析成参数字典方法
+(NSMutableDictionary *)dealWithUrlStr:(NSString *)UrlStr{ NSMutableDictionary *resultDict = [NSMutableDictionary dictionary]; NSRange rangeOne = [UrlStr rangeOfString:@"?"]; NSRange ra
2015-12-25 11:13:23 576
原创 FMDB存储字典或数组
储,你查询获取数据时就会获取无法转换成字典或数组的字符串。转换JSON存储:NSArray *picArr = (NSArray *)dic[@"pic"]; NSError *err = nil; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:picArroptions:NSJ
2015-12-25 11:10:18 2339
原创 跳转到该应用在系统中的设置页面
NSURL*url = [NSURLURLWithString:UIApplicationOpenSettingsURLString]; if ([[UIApplicationsharedApplication]canOpenURL:url]) { [[UIApplicationsharedApplication]openUR
2015-12-25 11:08:22 305
原创 上传本地项目到github
第一步:创建新repository第二步:复制ssh地址,然后是从头部的Source Control->Configure xxDemo->Remotes->’+’号->Add Remote..,最后在Address栏里面填写ssh地址、填写github账户,就可以push代码到github上面
2015-12-25 10:56:16 257
原创 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 1417
原创 信用卡绑定(BrainTree)
//BrainTree ioshttps://developers.braintreepayments.com/start/hello-client/ios/v4/** * 获取payment-method-once参数 */-(void)getPaymentMethodOnceWithClientToken:(NSString*)ClientToken{
2015-12-25 10:52:34 1484 1
原创 仿安卓UITableview 预加载数据
//每次预加载成功后 _index+= RowNumber;-(void)scrollViewDidScroll:(UIScrollView*)scrollView{ if (scrollView == self.performaceTable) { NSIndexPath *path = [self.performaceTable
2015-12-25 10:50:11 1756
广告轮播控件
2015-12-25
UIColor+JKUI颜色转化
2015-12-25
JKLoading封装loading类型
2015-12-25
本地存储NSUserdefault封装(可存储各种类型)
2015-12-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人