开发中常遇到的小问题

1.手贱升级macOS Sierra引发的问题,即解决方法


开发中常遇到的小问题_第1张图片
Snip20161215_1.png
开发中常遇到的小问题_第2张图片
Snip20161215_2.png

3.iOS the file "xxx.app" couldn't be opened because you don't have permission to view it.
解决方法:

开发中常遇到的小问题_第3张图片
Snip20161220_1.png

修改Executable file 名称为上图所述
2.- (CGRect)convertRect:(CGRect)rect toView:(nullable UIView *)view;

  • (CGRect)convertRect:(CGRect)rect fromView:(nullable UIView *)view;两个方法的使用:
    作用:进行坐标的转换,代码示例如下:
   UIView *subView = [[UIView alloc]initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 200)];
  subView.backgroundColor = [UIColor grayColor];
  [self.view addSubview:subView];
  
  UIView *testView = [[UIView alloc]initWithFrame:CGRectMake(0, 50, self.view.frame.size.width, 100)];
  testView.backgroundColor = [UIColor orangeColor];
  [subView addSubview:testView];
  
  NSLog(@"testView变换前的坐标:%@",NSStringFromCGRect(testView.frame));

  CGRect rect = [subView convertRect:testView.frame toView:self.view];
// 或者用以下方法转换,convertRect:后面跟的参数一般是需要转换的view
  CGRect rect = [self.view convertRect:testView.frame fromView:subView];
  NSLog(@"testView变换后的坐标:%@",NSStringFromCGRect(rect));

打印结果如下:

    2017-05-17 16:33:31.060296+0800 ConvertTest[16540:6724949] testView变换前的坐标:{{0, 50}, {320, 100}}
    2017-05-17 16:33:31.060413+0800 ConvertTest[16540:6724949] testView变换后的坐标:{{0, 250}, {320, 100}}

你可能感兴趣的:(开发中常遇到的小问题)