加这么些断点完全不欲动一下鼠标(恕我吹牛B了),5.粗暴关闭app的章程

1.哪些高效的翻一段子代码的行时。

#define TICK   NSDate *startTime = [NSDate date]
#define TOCK   NSLog(@"Time: %f", -[startTime timeIntervalSinceNow])

于想要翻看执行时的代码的地点举行这样处理

TICK
//do your work here
TOCK

1.颜色变型成为图

2.争迅速查看一个函数的调用次数,且未弥加同句代码。 如下图

365体育网投 1

look Hitcount

这种方法可为一个if方法,一个for循环,而且免会合搁浅程序,切不需要加以相同句子代码。不过毫无疑问要记选中下面的automatically
continue after evaluting actions;

3.于用view的缩放的上,layer.border.width随着view的推广,会冒出锯齿化的题目,解决之题目需要装是特性。

self.layer.allowsEdgeAntialiasing = YES;

- (UIImage *)createImageWithColor:(UIColor *)color
{
    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}

2.app评分跳转

4.instrument中time profile 中的self, #self,%self各代表什么 ?

365体育网投 2

365体育网投,self

下引用了一下网上的具体内容

Self is “The number of times the symbol calls itself.” according to
the Apple Docs on the Time Profiler.

From the way the numbers look though, it seems self is the summed
duration of samples that had this symbol at the bottom of its stack
trace. That would make:

self: the number of samples where this symbol was at the bottom of the
stack trace
% self: the percent of self samples relative to total samples of
currently displayed call tree
(eg – #self / total samples).
So this wouldn’t tell you how many times a method was called. But it
would give you an idea how much time is spent in a method or lower in
the call tree.

-(void)goToAppStore
{
    NSString *str = [NSString stringWithFormat:
                     @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d",547203890];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}

6.争快捷补给加一个大局分外断点,(一步到三步)。和丰裕一个symbloic断点,(一步依旧暨三步)添加一个断点不使用鼠标

365体育网投 3

add breakPoint

张图了咔嚓,加这个断点完全无待动一下鼠标(恕我吹牛B了),加单独断点的时动了产鼠标,但这是自故意为你们看本人是暴发鼠标的。

  • 首先All Exception断点是大家挺常用之,这多少个我是如此用一个快速键做到的!通过改键command +p
    为加分外断点的,要说怎么转,翻自家原先博客去!
  • 接下来加symbloic的急速键为commnamd + option + \
  • 加一个独门一进行断点的快速键为command + \

好吧,就说那多少个吧,最近准备把xVim搞纯,什么鼠标,触摸板统统都倒起来!

3.到手当前系统语言环境

NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defs objectForKey:@"AppleLanguages"];
NSString *preferredLang = [languages objectAtIndex:0];

4.总结字符串的惊人

NSString *str = @"chuanzhang";
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
NSDictionary *dicAtt = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:15],NSFontAttributeName,paragraphStyle.copy,NSParagraphStyleAttributeName, nil];
NSAttributedString *attribute = [[NSAttributedString alloc]initWithString:str attributes:dicAtt];
CGRect frame = [attribute boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil];

5.强行关闭app的道

// 私有API
[[UIApplication sharedApplication] performSelector:@selector(terminateWithSuccess)];
// C语言方法
exit(0);

6.怎么高效的查看一段代码的履行时间

#define TICK   NSDate *startTime = [NSDate date]
#define TOCK   NSLog(@"Time: %f", -[startTime timeIntervalSinceNow])
// 在想要查看执行时间的代码的地方进行这么处理
TICK
//do your work here
TOCK

7.每当运用view的缩放的时光,layer.border.width随着view的扩,会冒出锯齿化的题目,解决之题目亟待装是特性。

self.layer.allowsEdgeAntialiasing = YES;

8.instrument中time profile 中的self, #self,%self各代表什么 ?

333.jpeg

脚引用了须臾间网上的具体内容

Self is “The number of times the symbol calls itself.” according to
the Apple Docs on the Time Profiler.

From the way the numbers look though, it seems self is the summed
duration of samples that had this symbol at the bottom of its stack
trace. That would make:

self: the number of samples where this symbol was at the bottom of the
stack trace

% self: the percent of self samples relative to total samples of
currently displayed call tree

(eg – #self / total samples).
So this wouldn’t tell you how many times a method was called. But it
would give you an idea how much time is spent in a method or lower in
the call tree.

9.神器总计图片地方的函数:AVMakeRectWithAspectRatioInsideRect()
经过此函数,我们得统计一个图形在其他一个 view
遵照一定的比例位居中形,可能说之自比空虚,依然用图来体现,可以说她好一向一个
image 以其余的百分比显示显示在 imageview 中在中所处之职务,拿
UIViewContontAspectFit来演示

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 300, 300)];
imageView.center = self.view.center;
imageView.backgroundColor = [UIColor redColor];
imageView.contentMode = UIViewContentModeScaleAspectFit;
UIImage *image = [UIImage imageNamed:@"mm.jpg"];
imageView.image = image;

 CGRect iamgeAspectRect = AVMakeRectWithAspectRatioInsideRect(image.size, imageView.bounds);
NSLog(@"iamgeAspectRect = %@, imageView =%@",NSStringFromCGRect(iamgeAspectRect),NSStringFromCGRect(imageView.frame));
[self.view addSubview:imageView];

图片展现如下:

mm.png

log 打因结果如下:

iamgeAspectRect = {{37.563884156729145, 0}, {224.87223168654171, 300}}, imageView ={{37.5, 183.5}, {300, 300}}

得于 log 得出 对应的 image 以 aspectFit 的不二法门于 imageView 的岗位,在
imageView
中的职务是(37.5,0)。这样您从不待其他多之代码来总括了。(ps:这么些函数是于
AV框架的,童鞋们自行导入。)

切实它的另外的利益,假如您是做相机或者图片处理的若尽管清楚她的便宜了,什么处理横屏照片了,16:9,1:1,4:3图于控件被的岗位,控件上之接触对承诺图片及的触及的职位拉,等等。

10.关于
假若一个矩形即使做了扳平移旋转缩放等同样多级操作之后,上下横之季只点(甚至矩形上无限制一个接触)的岗位。

CGPoint originalCenter = CGPointApplyAffineTransform(_mStyleLeftEyeView.center,
                                                     CGAffineTransformInvert(_mStyleLeftEyeView.transform));

//1左眼内眼角
CGPoint bottomRight = originalCenter;
bottomRight.x += _mStyleLeftEyeView.bounds.size.width / 2;
bottomRight.y += _mStyleLeftEyeView.bounds.size.height / 2;
bottomRight = CGPointApplyAffineTransform(bottomRight, _mStyleLeftEyeView.transform);

率先是 styleLeftView 就是一个矩形的
view,这里以右手下角的点做示范,做无论做了另外的 tranform
之后都得得到其的触及的地点
11.tableViewCell齐的button,点击获取所在row

UITableViewCell *cell = (UITableViewCell *)[[btn superview] superview];
NSIndexPath * indexPath = [self.tableView indexPathForCell:cell];

12.安装粘贴内容

[UIPasteboard generalPasteboard].string = @"string";
// 获取粘贴内容
 NSString *string = [UIPasteboard generalPasteboard].string;

13.HUAWEI以节约电力所以有一个自动休眠机制,假使想叫咱的APP不自动进入休眠只需要装
UIApplication的idle提姆erDisabled 属性为 YES 即可。(切勿滥用)
示例:

[UIApplication sharedApplication].idleTimerDisabled = YES;

14.UIApplicationUserDidTakeScreenshotNotification通报,当用户截屏时接触

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenCapture) name:UIApplicationUserDidTakeScreenshotNotification object:nil];
- (void)screenCapture{
    // doSomething
}

相关文章