I want to pass a view which has been made in 1st view like over here
if (self.bookDetailViewController == nil)
{
iPhoneStreamingPlayerViewController *aBookDetail = [[iPhoneStreamingPlayerViewController alloc] initWithNibName:@"iPhoneStreamingPlayerView" bundle:nil];
self.bookDetailViewController = aBookDetail;
NSLog(@"View initilaized");
[aBookDetail release];
}
//call a method from another class like over here
[booksNavController1 n开发者_Go百科owPlayingView:bookDetailViewController];
//in 2nd view controller
-(void)nowPlayingView:(iPhoneStreamingPlayerViewController *)NPView
{
nowPlayingSong = NPView;
}
-(void)getSng:(NSString *)sng
{
name = sng;
}
//ibacton for toolbar button
-(IBAction)nowPlaying
{
Music_appAppDelegate *delegate = [[UIApplication sharedApplication]delegate];
[delegate.booksNavController pushViewController:nowPlayingSong animated:YES];
}
here is what is nsloged "Application tried to push a nil view controller on target . Terminating in response to SpringBoard's termination."
Don't release aBookDetail. i.e. comment out this line:
[aBookDetail release];
Try that and see if it works.
You have to structure your programm differnetly. The reason why you get null is because your class executes before you print the output.
Parser *parserClass = [Parser new];
parserClass.array = [[NSArray alloc]initWithObjects:@"One",@"Two", nil];
NSLog(@"%@", parserClass.array);
Sorry but you have to structure your class differently.
Or you could use the (AppDelegate *)[[UIApplication sharedApplication]delegate];
to allow sharing between the class and the AppDelegate and then subclass accordingly.
精彩评论