4
3 개의 버튼이있는 사용자 정의 tableviewcell을 사용하고 있습니다.InterfaceOrientation의 customCell 내부에서 UIButtons 위치를 변경하십시오.
내가 내 사용자 지정 셀에서 layoutSubviews 방법 내부 버튼의 프레임을 설정
-(void)layoutSubviews
{
[super layoutSubviews];
CGRect frame;
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
{
frame = CGRectMake(310, 7, 55, 35);
_prod.frame = frame;
frame = CGRectMake(365, 7, 55, 35);
_leva.frame = frame;
frame = CGRectMake(220, 4, 65, 65);
_imageButton.frame = frame;
}
else{
frame = CGRectMake(150, 7, 55, 35);
_prod.frame = frame;
frame = CGRectMake(205, 7, 55, 35);
_leva.frame = frame;
frame = CGRectMake(120, 4, 65, 65);
_imageButton.frame = frame;
}
}
문제는, 때 예를 들어, 테이블 뷰, 방향을 변경 한 후, 가로로 사용자가 스크롤, 모든 버튼은 이전 세로 위치로 돌아갑니다. 그리고 heres는 내가 셀을 초기화하는 방법 :
LojaCell *cell = (LojaCell *) [tableView dequeueReusableCellWithIdentifier: @"LojaCell"];
if(cell == nil) cell = [[LojaCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"LojaCell"];