2010-09-20 58 views
0

我正在使用下面的代碼,但子視圖添加在父視圖下面不是父視圖(self.view)..任何幫助嗎?addsubview給出錯誤的輸出?

-(IBAction)okbutton:(id)sender 

{ 

     obj = [[imgViewNextController alloc] initWithNibName:@"green" bundle:nil]; 

      obj.view.frame = self.view.frame; 

    [UIView beginAnimations:@"curldown" context:nil]; 
    [UIView setAnimationDelegate:self]; 
    [UIView setAnimationDuration:.5]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES]; 
    [self.view addSubview:obj.view]; 
    //[self.view insertSubview:obj.view aboveSubview:self.view]; 
    [UIView commitAnimations]; 

回答

1

您是否正在使用TableView?

有些物體做(奇怪)的事情,所以它可能有關係。

如果可能,請提供有關自己對象的更多信息。

順便說一句,你可以嘗試

[ self.view insertSubview: atIndex: ];

[ self.view insertSubview: aboveSubview: ];>

祝您好運!