开发者

Unable to push the VIEW

I've a DashBoard View which has labels开发者_JAVA技巧 and imageViews drawn on it. In my application, i want to push the a view which is in StaticPage.h when I touch any ImageView.

I used the concept of UITouch which has method "- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event" as follows:

 - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
NSLog(@"touches began");

if ( [touch view] == _icon) {
StaticPage *staticPage = [[StaticPage alloc] initWithNibName:@"StaticPage" bundle:nil];
[self.navigationController pushViewController:staticPage animated:YES];
[staticPage release];
}

}

where the StaticPage which inherits from UIViewController. _icon is a UIImageView.

In the AppDelegate, this method "- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions" is as follows:

  self.window.rootViewController = self.viewController;
[_window addSubview:navController.view];
[self.window makeKeyAndVisible];
return YES;

where navController is declared in .h file of StaticPage as UINavigationController *navController; and synthesized in .m file of StaticPage.

I wonder why my view from StaticPage is not getting pushed?? Any Help... Thank You in Advance


I figured out the navigation but not using method pushViewController:animated. Using presentModalViewController:animated we can navigate to the desired page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜