Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如何在ipad中从UIViewController子类启动UIView子类_Objective C - Fatal编程技术网

Objective c 如何在ipad中从UIViewController子类启动UIView子类

Objective c 如何在ipad中从UIViewController子类启动UIView子类,objective-c,Objective C,view2是UIViewController的一个子类。view1是UIView的一个子类 如何从view2启动view1 我试过了 [自我解散Modalviewcontrolleranimated:是] 及 UIViewControllerhandler.hidden=是 首先,使用更好的命名。如果某物是UIViewController子类,请将其称为myViewController或myView以外的任何东西 为了回答您的问题,我们需要更多的信息,例如您试图从何处执行此操作,您如何显示视图,

view2是UIViewController的一个子类。view1是UIView的一个子类

如何从view2启动view1

我试过了

[自我解散Modalviewcontrolleranimated:是]


UIViewControllerhandler.hidden=是

首先,使用更好的命名。如果某物是UIViewController子类,请将其称为myViewController或myView以外的任何东西

为了回答您的问题,我们需要更多的信息,例如您试图从何处执行此操作,您如何显示视图,您是否使用
UINavigationController
来处理这些视图,等等。从您的示例来看,您的视图1(a
UIView
)有一个名为
view2
UIViewController
子类,您要关闭该子类以重新显示第一个视图。Ff就是这种情况
[view2.view removeFromSuperview]将起作用


为了更好地理解导航和视图控制器,我想看一看苹果公司提供的用户界面指南。

thanx现在很多时候都在工作,而且我没有使用UINavigationController处理程序,我正在研究我的视图2中的scrollView中的触摸概念。 我在view2中编写的工作代码(即:UIViewController的子类):

(void)touchesend:(NSSet*)toucheevent:(UIEvent*)event

{

}

 NSSet *allTouches=[event allTouches];
switch ([allTouches count]) 
{    //for single touch
 case 1:{

            UITouch *touch [[allTouchesallObjects]objectAtIndex:0];
            switch ([touch tapCount]) 
           { case 1:// action part  
            //break;
             case 2://CODE to return from UIViewContoller to UIView

            [self.view removeFromSuperview];
             break;
           }
         }break;

   //for double touch
   case 2:
   { //action part
   }break;
}