去除TextView的四个内边距

1.去除UITextView四个内边距

      self.briefTextView.textContainer.lineFragmentPadding = 0; 
      self.briefTextView.textContainerInset = UIEdgeInsetsZero;

2.隐式动画的控件响应不了点击事件 UIView做动画的时候把options设置

    UIViewAnimationOptionAllowUserInteraction

3.TableView/CollectionView 的cell点击事件和手势事件冲突时解决方法:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
if([touch.view isDescendantOfView:self.collectionView]){
    return false;
}
return true;}

4.重写UITableViewCell的坐标

- (void)setFrame:(CGRect)frame{
  static CGFloat margin = 15;
  frame.origin.x +=margin;
  frame.size.width -=margin * 2;
  [super setFrame:frame];}

5.App内打开苹果健康App

NSURL *healthAppURL = [NSURL URLWithString:@"x-apple-health://"];
if ([[UIApplication sharedApplication] canOpenURL:healthAppURL]) {
    [[UIApplication sharedApplication] openURL:healthAppURL
                                       options:@{}
                             completionHandler:^(BOOL success) {
        
    }];
} else {
    NSLog(@"无法打开苹果健康应用程序");
}

6.collectionView 跳转到水平方向的中间。

   [collectionView scrollToItemAtIndexPath:indexPath
          atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally
                                                          animated:YES];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容