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];
网友评论