- 博客(59)
- 收藏
- 关注
原创 Xcode 清理存储空间
移除 Xcode 运行安装 APP 产生的缓存文件(DerivedData)只要重新运行Xcode就一定会重新生成,而且会随着运行程序的增多,占用空间会越来越大。删除后在重新运行程序可能会稍微慢一点,建议定期清理。路径:~/Library/Developer/Xcode/DerivedData释放空间:0~xx GB移除 APP 打包的ipa历史版本(Archi
2017-08-31 18:07:51 284
原创 clock()函数的使用
clock() 函数的返回值类型是clock_t,它除以CLOCKS_PER_SEC来得出时间,一般用两次clock函数来计算进程自身运行的时间.
2017-02-23 13:44:55 2171
原创 把定时器加到RunLoop里面 使NSTimer不会因为拖动页面而失效
NSTimer *timer = [NSTimer timerWithTimeInterval:5 target:self selector:@selector(timerAction) userInfo:nil repeats:YES];[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
2016-10-09 09:58:20 276
原创 图片360旋转
CABasicAnimation *rotationAnimation; rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; rotationAnimation.toValue = [NSNumber numberWithFloat:M_PI * 2.0];
2016-08-23 13:32:47 310
原创 UITableViewCell显示动画
CATransform3D rotation;//3D旋转 rotation = CATransform3DMakeTranslation(0 ,50 ,20);// rotation = CATransform3DMakeRotation( M_PI_4 , 0.0, 0.7, 0.4);
2016-07-27 14:20:39 465
原创 将Navigationbar变成透明而不模糊
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];self.navigationController.navigationBar .shadowImage = [UII
2016-07-21 14:27:12 271
原创 应用内部评分
#import SKStoreProductViewControllerDelegateSKStoreProductViewController *storeProduct = [[SKStoreProductViewController alloc]init]; storeProduct.delegate = self; [storeProduct loa
2016-07-19 11:43:42 245
原创 视图层级切换
将一个UIView显示在最前面只需要调用其父视图的 bringSubviewToFront()方法。将一个UIView层推送到背后只需要调用其父视图的 sendSubviewToBack()方法。
2016-07-07 14:10:00 343
原创 GCD线程
//开启线程 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ //异步操作 //回到主线程 dispatch_async(dispatch_get_main_queue(), ^{
2016-06-29 14:25:53 251
原创 字符串转字典类型
NSData *jsonData = [String dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil];
2016-06-23 17:57:18 740
原创 得到中英文混合字符串长度
- (NSInteger)getToInt:(NSString*)strtemp{ NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000); NSData* da = [strtemp dataUsingEncoding:enc];
2016-05-05 10:39:26 389
原创 系统自带定位坐标转为城市名
//系统自带定位 [[MPLocationManager shareInstance] startSystemLocationWithRes:^(CLLocation *loction, NSError *error) { if (!error) { CLGeocoder *geocoder=[[CLGeocoder alloc]init];
2016-05-04 11:17:29 866
原创 下拉改变导航栏透明度
//让self观察myScrollView里面的contentOffset的值 是否发生改变 [myScrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];//只要值
2016-04-16 15:48:37 1561
原创 View.Transform动画
[UIView animateWithDuration:0.1 animations:^{ View.transform = CGAffineTransformMakeRotation(M_PI_2);}];
2016-04-13 10:56:42 204
原创 输入框替换掉表情
//禁止输入表情- (NSString *)disable_emoji:(NSString *)text{ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[^\\u0020-\\u007E\\u00A0-\\u00BE\\u2E80-\\uA4CF\\uF900-\
2016-04-13 10:03:11 351
原创 手势传递到其它控件
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide)]; //设置成NO表示当前控件响应后会传播到其他控件上,默认为YES。 tapGestureRecognizer.can
2016-04-06 16:24:02 255
原创 解决下拉刷新偏移
vc.automaticallyadjustsScrollviewInsets = NO nav的第一个子视图是scrollview的时候 系统才自动给scrollview加上64的inset 这偏移与第三方的下拉刷新冲突
2016-03-29 09:58:47 746
原创 让 View 可以移动
//添加事件UIPanGestureRecognizer *pan_top = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panTopView:)];//处发事件方法CGPoint point = [pan translationInView:self.view]; CGPo
2016-03-17 14:50:58 275
原创 打开应用的系统设置
[[UIApplicationsharedApplication] openURL:[NSURLURLWithString:UIApplicationOpenSettingsURLString]];
2016-03-01 17:39:43 306
原创 写在Plist 里的授权
与些类似的还有NSCalendarsUsageDescription 用于访问日历, NSContactsUsageDescription 用于访问通讯录,NSPhotoLibraryUsageDescription 用于访问相册,NSRemindersUsageDescription用于访问提醒。
2016-01-15 16:44:55 310
原创 更改状态栏颜色
在plist文件里添加 View controller-based status bar appearance == NO 默认是YES然后你写更改状态栏颜色的方法就有效果了
2015-11-30 16:06:26 269
原创 通过代码区分是否为推送启动应用
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ NSURL *url = [options objectForKey:UIApplicationLaunchOptionsURLKey]; if(url)
2015-10-30 18:50:48 384
原创 禁止第三方输入法
- (BOOL)application:(UIApplication*)application shouldAllowExtensionPointIdentifier:(NSString*)extensionPointIdentifier{ returnNO;}
2015-10-13 16:10:53 1052
原创 sizeToFit自动改变尺寸
(void)sizeToFit得到最适合当前字数的尺寸,1 新建一个UILabel *label,尺寸CGRectMake(10,10,150,20); [label setNumberOfLine:1]; [label setBackgroundColor:[UIColor clearColor];2 之后从键盘输入到UITextField中一定数量文字,将文
2015-09-23 16:51:36 299
原创 1秒后加载
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // do something });
2015-09-23 16:47:01 286
原创 代码修改约束
//修改当前View自身约束 NSArray* constrains = self.View.constraints; for (NSLayoutConstraint* constraint in constrains) { if (constraint.firstAttribute == NSL
2015-09-12 12:48:37 446
原创 UI控件圆角设置
uiview.layer.cornerRadius = 10;除了maskToBounds = YES 是可以的 还可以设置 clipsToBounds = YES 也可以
2015-09-04 21:26:37 344
原创 AFNetwork设置头信息
[self.requestSerializersetValue:@"application/json"forHTTPHeaderField:@"Accept"];
2015-09-04 10:51:33 274
原创 AFNetWork设置身份验证
[self.requestSerializersetAuthorizationHeaderFieldWithUsername:[[NSUserDefaultsstandardUserDefaults]objectForKey:@"token"]password:@""];
2015-09-04 10:45:00 519
原创 UITabBarItem 只有图片,没有文字,图片居中
tabbaritem.imageInsets=UIEdgeInsetsMake(6, 0,-6, 0);
2015-08-29 19:16:10 785
原创 在windows添加视图
//程序启动完成调用- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)lanchOptions{//创建windowsself.winow = [[UIWindow alloc]intiWithFrame:[[UIScreen mainScreen]b
2015-08-19 11:02:59 403
原创 UITabbarController 点击返回第一个视图
UITabbarController 代理方法- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{if(viewController.tabBarItem.tag ==
2015-08-19 10:13:00 482
原创 返回上两个视图
[self.navigationControllerpopToViewController:[self.navigationController.viewControllersobjectAtIndex:([self.navigationController.viewControllerscount] -2)]animated:YES];
2015-08-14 14:28:03 318
原创 一句话删除所有子视图
[view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
2015-08-12 12:27:45 391
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人