Iphone 从uiview调用pushViewController
让我向你解释我的问题: 我有一个带有2个UIView的UIViewController。 我在一个UIView中有一个按钮,我从UIViewController调用一个methodeIphone 从uiview调用pushViewController,iphone,uiview,pushviewcontroller,Iphone,Uiview,Pushviewcontroller,让我向你解释我的问题: 我有一个带有2个UIView的UIViewController。 我在一个UIView中有一个按钮,我从UIViewController调用一个methode [controller actionMainSettings]; 这就是方法: -(void)actionMainSettings{ MainSettings *mainController = [[MainSettings alloc] initWithNibName:@"MainSettin
[controller actionMainSettings];
这就是方法:
-(void)actionMainSettings{
MainSettings *mainController = [[MainSettings alloc] initWithNibName:@"MainSettings" bundle:nil];
[self.navigationController pushViewController:mainController animated:YES];
[[self navigationController] setNavigationBarHidden:YES animated:NO];
[mainController release];
}
MainSettings是一个UIVewController
什么也没发生
当我把我的按钮放在我的UIVIewController([self.view addSubview:buttonSettings];
)中时,没关系,但我想把它放在另一个UIView中
有人能解释一下发生了什么事吗
thx对此我不是很确定,但您可以尝试
super.navigationController
而不是self
另外,从代码的外观来看,我假设它是一个设置视图。我建议您使用
[自我呈现模式视图:yourView动画:是]
。您可以在中查看一系列动画。我尝试了[self-presentModalView:yourView animated:YES],但没有任何效果:(这可能与视图的初始化有关,您能否发布初始化视图时使用的代码?此外,您是否为视图创建了新类,或者您是否允许初始化默认视图类?算了吧,我刚刚意识到它已经存在了,您确定您指定的nib名称存在吗?如果您的视图是某个其他视图的子类,您在为视图创建文件时选中了“With XIB for user interface”选项,因此指定NIB名称没有多大意义,因为它已经隐含在您的子类中……如果是这样,您应该使用默认初始化(例如,MainSettings*mainController=[[MainSettings alloc]init]
)然后将其传递给presentModalView:animated:
方法。好的,还有一件事,我真的很抱歉,该方法是presentModalViewController
,而不是presentModalView
,我的错,考虑到我刚才所说的一切,请再试一次。我将我的方法放在我的代理中,很好。非常感谢您的帮助;)