1
내 UIButton의 탭 영역이 iOS 11부터 작아지는 것을 확인했습니다. 확인하기 위해 하위 뷰에서 원하는 배경색을 주석 처리하고 버튼 자체에 자주색을 삽입했습니다.iOS 11에서 UIButton 탭 영역이 작아졌습니다.
내 코드는 다음과 같다.
UIImage *ringImage = [UIImage imageNamed:@"ball20r"];
UIEdgeInsets insets = UIEdgeInsetsMake(10,10,10,10); //padding
UIImage *stretchableImage = [ringImage resizableImageWithCapInsets:insets];
UIImageView *imageView = [[UIImageView alloc]initWithImage:stretchableImage];
// imageView.backgroundColor = backgroundColor; //disabled for testing
imageView.frame = CGRectMake(0, 0, label.frame.size.width + 16.0, label.frame.size.height + 16.0);
[imageView addSubview:label];
label.translatesAutoresizingMaskIntoConstraints = NO;
NSDictionary *viewsDictionary = @{@"label":label};
NSArray *constraint_H = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(8)-[label]-(8)-|"
options:0
metrics:nil
views:viewsDictionary];
NSArray *constraint_V = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(8)-[label]-(8)-|"
options:0
metrics:nil
views:viewsDictionary];
[imageView addConstraints:constraint_H];
[imageView addConstraints:constraint_V];
UIButton *calendarButton = [UIButton buttonWithType:UIButtonTypeCustom];
[calendarButton addTarget:self action:@selector(chooseACalendarToSave) forControlEvents:UIControlEventTouchUpInside];
calendarButton.frame = imageView.frame;
[calendarButton addSubview:imageView];
//added for testing only
calendarButton.backgroundColor = [UIColor purpleColor];
_calendarButton = [[UIBarButtonItem alloc]initWithCustomView:calendarButton];
iOS 용 영역을 iOS 10.0.3 이하와 같이 만들려면 어떻게해야합니까? 도움 주셔서 감사합니다.