UINavigation问题 [英] UINavigation Problem

查看:90
本文介绍了UINavigation问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在View Controller类中的一个按钮点击选项上导航一个类。请给出方法这样做。我使用给定的以下代码来执行此按钮点击。

   - (void)buttonAction {
Status * status = [[Status alloc] init];
[self.navigationController pushViewController:status animated:YES];
}

//状态是UIViewController子类


解决方案

 (void)buttonAction 
{
Status * status = [[Status alloc] init]; // this is not proper b $ b [self.navigationController pushViewController:status animated:YES];
}

您必须使用

 (void)buttonAction 
{
Status * status = [[Status alloc] initWithNibName:@YourNibbundle:nil];
[self.navigationController pushViewController:status animated:YES];
[status release];
}

这里您的nib是要显示的xib的名称。 p>

编辑:



现在你的应用程序是基于查看的



(void)buttonAction
{
所以make appDelegate类的对象(suppos objApp)
现在,

 code> Status * status = [[Status alloc] initWithNibName:@YourNibbundle:nil]; 
[objApp.window addSubview:status.view];
[status release];
}


I want to navigate a class on a button click option in a View Controller class. Please give the way to do this. I am using the given following code to do this on a button click.

- (void)buttonAction {
  Status *status = [[Status alloc] init];
  [self.navigationController pushViewController:status animated:YES];
}

// Status is a UIViewController subclass

解决方案

(void)buttonAction
{
  Status *status = [[Status alloc]init];//this is not proper
  [self.navigationController pushViewController:status animated:YES]; 
}

you must use

(void)buttonAction
{
  Status *status = [[Status alloc]initWithNibName:@"YourNib" bundle:nil];
  [self.navigationController pushViewController:status animated:YES]; 
  [status release];
}

here your nib is the name of xib which you want to display.

Edit:

now you application is view based so

(void)buttonAction { so make object of appDelegate class(suppos objApp) now,

  Status *status = [[Status alloc]initWithNibName:@"YourNib" bundle:nil];
  [objApp.window addSubview:status.view]; 
  [status release];
}

这篇关于UINavigation问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆