내 앱에서 사용자 정의 UITableViewCell
을 사용하고 있으며 "삭제할 스 와이프"버튼의 프레임을 조정하려고합니다. 그것은 대단한 새로운 위치에 표시UITableView "스 와이프하여 삭제"버튼 프레임 문제
- (void)layoutSubviews {
[super layoutSubviews];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) return;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.0f];
for (UIView *subview in self.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) {
CGRect newFrame = subview.frame;
newFrame.origin.x = newFrame.origin.x - 25;
subview.frame = newFrame;
} else if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellEditControl"]) {
CGRect newFrame = subview.frame;
newFrame.origin.x = newFrame.origin.x - 25;
subview.frame = newFrame;
}
}
}
:
이 내가 뭘하는지입니다. 그러나 버튼을 클릭하여 사라지게하면 버튼이 갑자기 왼쪽으로 약 10 포인트 이동 한 다음 제거됩니다.
왜 이런 일이 발생하며 어떻게 해결할 수 있습니까?
이 코드는 사용자 정의 TableViewCell 클래스에 있습니까? – jhilgert00
예 내 사용자 지정 UITableViewCell 클래스입니다. –