addsubview给出了错误的输出?

时间:2010-09-20 09:17:32

标签: iphone ipad uiview addsubview

我正在使用以下代码,但是在父视图下面添加了子视图而不是父视图(self.view)..请问有什么帮助吗?

 -(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 个答案:

答案 0 :(得分:1)

您使用的是TableView吗?

有些对象会做(奇怪的)事情,所以它可能是相关的。

如果可能,请使用有关您的自我对象的更多信息。

顺便说一下,你可以试试

[ self.view insertSubview: atIndex: ];

[ self.view insertSubview: aboveSubview: ];>

祝你好运!

相关问题