【发布时间】:2012-03-08 21:40:37
【问题描述】:
我在我的应用程序中使用UINavigationController,由于某种原因,它不允许我将页面切换到名为CompanyView 的third xib。它从第一到第二转换得很好,但不是第二到第三。我可能做错了什么,但如果有人可以查看我的代码,那就太好了。我相信我的按钮设置正确。
这是我的.h file xib 不会改变视图:
#import <UIKit/UIKit.h>
#import "CompanyView.h"
@interface MenuView : UIViewController
-(IBAction)btnClicked:(id)sender;
@end
这是我的.m file 代码:
#import "MenuView.h"
@implementation MenuView
-(IBAction)btnClicked:(id)sender {
CompanyView * companyView = [[CompanyView alloc] init];
companyView.title = @"Company";
[self.navigationController pushViewController:companyView animated:YES];
[companyView release];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
【问题讨论】:
标签: iphone ios5 uinavigationcontroller xcode4.2 uinavigationbar