开发者

UITable View Issue,

hello i am having same issue, i tried your solution but it didnt help me in my case.. i am not getting exception but view is not getting changed..

my piece of code is as below

printf("hi");
//Get the selected country
NSString *selectedCountry = [listOfItems objectAtIndex:indexPath.row];
//Initialize the detail view controller and display it.
DetailViewController *aSecondView = [[DetailViewController alloc]  initWithNibName:@"DetailView" bundle:nil];
// aSecondView.selectedCountry = selectedCountry;
[self.navigationController pushViewController:aSecondView];
[aSecondView release];
aSecondView = nil;
printf("bye..");

both hi an开发者_开发问答d bye gets printed but view doesnt change.. i have wasted 2 days around it .. plz help me out..


Check the nib name.How did you created the nib file for the detail view?.It will be created by default as DetailViewController in your case.So change the initWithNibName.Why do you set the aSecondView=nil?

as kovpas said , that subclass your controller from UIViewController instead of UINavigationController ,you use presentModalViewController. for implementing navigation controller put this code in your delegate class

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
UINavigationController *nvcontrol =[[UINavigationController alloc] initWithRootViewController:viewController];

[window addSubview:nvcontrol.view];

[window makeKeyAndVisible];

}


Seems, that you subclass your controller from UIViewController instead of UINavigationController

Try to use

[self presentModalViewController:aSecondView animated:YES];

Dismiss it with

[self dismissModalViewControllerAnimated:YES];


in case if you un comment your commented code...one another problem that i found in your code... interchange these 2 lines...

aSecondView.selectedCountry = selectedCountry;
[self.navigationController pushViewController:aSecondView];

try Put it like this

 [self.navigationController pushViewController:aSecondView];
  aSecondView.selectedCountry = selectedCountry;

if you uncommnet the line it may create problem

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜