2009-08-23 5 views
0

나는 왜 belowSubview가 작동하지 않는지에 대해 모두 혼란스러워한다.addSubview insertSubview aboveSubview 비트가 작동하지 않는 이유에 대해 혼동을 느낀다.

내 navigationController에 일부 (하위 뷰)를 추가하고 있는데 그 중 일부는 잘 작동합니다.

-(UITableView *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

... 
... 

    [self.navigationController.view addSubview:ImageView]; 
    [self.navigationController.view addSubview:toolbar]; 

내 앱에서 어떤 점을 추가하면 내 툴바 위에 다른 툴바 또는 이미지를 추가하고 싶습니다.

그래서 내가 그러나이 작동하지 않습니다이

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
    ... 
    ... 

     [self.navigationController.view insertSubview:NewImageView aboveSubview:toolbar]; 
//crucial of course [edit] 
      rvController = [RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle] mainBundle]; 
rvController.CurrentLevel += 1; 
rvController.CurrentTitle = [dictionary objectForKey:@"Title"]; 
[self.navigationController pushViewController:rvController animated:YES]; 
rvController.tableDataSource = Children; 
[rvController release]; 

같은 것을하고 있어요 가정 해 봅시다 .. 사람이 내가 여기에 잘못 뭘하는지 알고 있나요 ... 나는 다른 것을 사용했습니다해야 addSubview 대신 또는 다른 곳에 문제가 있습니까?

답변

1

게시 한 글에서 제대로 작동하는 것 같습니다.

그러나 몇 가지 다른 문제가 있습니다. 먼저 객체의 인스턴스를 나타내는 varibales가 소문자로 시작하는 것이 일반적입니다. 따라서 ImageViewNewImageViewimageViewnewImageView이어야합니다.

나는 tableView:didSelectRowAtIndexPath: 방법 newImageView과 툴바가 모두 유효하다는 것을 확인했습니다. 헤더 파일에 있습니까?

이 시도하고 오류를 여기서 참조 : 당신은 내 편집에서 볼 수있는) 그냥 약간의 실수를하여 반응

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
... 
... 
    NSAssert(self.navigationController.view,@"WTF? self.navigationController.view is nil"); 
    NSAssert([self.navigationController.view superview],@"WTF? lf.navigationController.view is not onscreen"); 
    NSAssert(newImageView,@"WTF? newImageView is nil"); 
    NSAssert(toolbar,@"WTF? toolbar is nil"); 
    NSAssert([toolbar superview],@"WTF? toolbar is on in the view"); 

    [self.navigationController.view insertSubview:newImageView aboveSubview:toolbar]; 
} 
+0

감사합니다 .. 당신이 옳았, 아무 문제가 없다. 새로운 뷰 컨트롤러를 밀어 넣었습니다. –

+0

원래 이미지 나 툴바 위에 새 이미지/툴바를 표시하려고합니까? 아니면 둘다? –

관련 문제