4、自定义BMKAnnotationView点击没有响应的问题
3、数组越界导致崩溃,查找源头
点击debug->BreakPoints->Create Exception BreakPoints,然后重新运行,断点就停留在导致崩溃的地方
2、通过UIBezierPath来设置圆角
通过设置圆角,一般会这样用:
self.button.layer.cornerRadius = self.button.frame.size.height / 2.0;
self.button.clipsToBounds = YES;
但要设置下图这样的圆角方式,上面的方法就不行了
设置圆角UIBezierPath *maskPath =[UIBezierPath bezierPathWithRoundedRect:self.button.bounds byRoundingCorners:UIRectCornerBottomRight | UIRectCornerTopRight cornerRadii:CGSizeMake(self.button.bounds.size.height/2, self.button.bounds.size.height/2)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.button.bounds;
maskLayer.path = maskPath.CGPath;
self.button.layer.mask = maskLayer;
其中,这些可以根据需要设置
UIRectCornerTopLeft = 1 << 0,
UIRectCornerTopRight = 1 << 1,
UIRectCornerBottomLeft = 1 << 2,
UIRectCornerBottomRight = 1 << 3,
UIRectCornerAllCorners
1、调整leftBarItem的点击范围
自定义一个Button,将这个Button加入到View中,再将View添加到leftBarItem里面。
UIButton*closeBtn = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];
[closeBtnsetImage:[UIImageimageNamed:@"publish_close"]forState:UIControlStateNormal];
[closeBtnaddTarget:selfaction:@selector(closeAction)forControlEvents:UIControlEventTouchUpInside];
closeBtn.frame=CGRectMake(0,0,44,44);
UIView*leftBackBtnView = [[UIViewalloc]initWithFrame:closeBtn.bounds];
leftBackBtnView.bounds=CGRectOffset(leftBackBtnView.bounds,10,0);
[leftBackBtnViewaddSubview:closeBtn];
self.navigationItem.leftBarButtonItem= [[UIBarButtonItemalloc]initWithCustomView:leftBackBtnView];
网友评论