회전

2012-04-08 6 views
0
에 레이어의 위치를 ​​변경하는 방법

내있는 tableView 세포는 그라디언트 레이어를회전

CAGradientLayer *gradient = [CAGradientLayer layer]; 
    gradient.frame = cell.contentView.bounds; 
    gradient.colors = 
    [NSArray arrayWithObjects: 
    (id)[[UIColor colorWithRed:0.85 green:0.85 blue:0.85 alpha:1] CGColor], 
    (id)[[UIColor colorWithRed:0.82 green:0.82 blue:0.82 alpha:1] CGColor], nil]; 
    [cell.contentView.layer insertSublayer:gradient atIndex:0]; 

어떤을 분명히 회전 내가

tableview.reloadData

를 호출 할 때까지이 궁금 초기 치수에 남아있는 경우 이것보다 더 정교한 접근법. 같은 중심에서 이미지를 가지고있는 navigationController와 함께 간다

,

UIImage *logo = [UIImage imageNamed:@"logo.png"]; 
UIImageView *logoimageview = 
[[UIImageView alloc] initWithFrame: 
CGRectMake(self.navigationController.navigationBar.bounds.size.width/2 - logo.size.width/2, 
      self.navigationController.navigationBar.bounds.size.height/2 - logo.size.height/2, 
      logo.size.width, logo.size.height)]; 

[logoimageview setImage:logo]; 

[self.navigationController.navigationBar addSubview:logoimageview]; 

그래서 이미지가 회전에서 자신의 위치를 ​​변경하지 않고, 내가 탐색에 대한 "새로 고침"방법을 잘 모르는 것 같아요 바.

답변

1

나는 이것을 테스트하지 않았 음을 경고해야하지만 autoresizingMask를 설정할 때 제대로 작동 할 것이라고 기대해야합니다. 로고 이미지보기 위해

cell.contentView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; 

:

logoimageview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; 
테이블 뷰 셀