view2是UIViewController的子类。 view1是UIView的子类。如何从UIViewController子类中的ipad启动UIView子类
如何从view2启动view1?
我试图
[自dismissModalViewControllerAnimated:YES];
and
UIViewControllerhandler.hidden = YES;
view2是UIViewController的子类。 view1是UIView的子类。如何从UIViewController子类中的ipad启动UIView子类
如何从view2启动view1?
我试图
[自dismissModalViewControllerAnimated:YES];
and
UIViewControllerhandler.hidden = YES;
首先,使用更好的命名。如果某个东西是UIViewController的子类,则称其为myViewController或除myView之外的其他东西。
要尝试回答您的问题,我们需要更多信息,例如您试图从中进行此操作的位置,您如何显示视图,是否使用UINavigationController
来处理它们等。从您的示例中,看起来你的view1(一个UIView
)有一个UIViewController
子类,称为view2
,你想解雇它来重新显示第一个视图。如果是这种情况,那么[view2.view removeFromSuperview];
将起作用。
我会看看Apple提供的用户界面指南,以更好地了解导航和视图控制器。
thanx现在工作很多,我没有使用UINavigationController处理程序,我正在处理scrollView中的Touch概念,它在我的view2中。写在视图2 我工作的代码(即:的UIViewController的子类):
(无效)touchesEnded:(NSSet中*)触及withEvent:方法(的UIEvent *)事件
{
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;
}
}