2012-04-23 63 views
0

我有2个不同的xcode项目。一个是主应用程序,它具有完整的设计准备等,并切换一些屏幕。然后我有一个位置应用程序,它会告诉你附近的医院等。我想要它做的是,如果我按主应用程序中的按钮,它会去的位置应用程序。所以我把这两个项目合而为一。终于它工作,但现在试图将位置应用程序链接到它的按钮时,它现在不会显示全屏。它只是向我展示了一张带医院,医生等的桌子,但我想看到位置应用程序的全屏。我认为这是rootviewcontroller。下面是代码:切换到RootViewController

.h文件中

#import <UIKit/UIKit.h> 
#import "VacaturesViewController.h" 
#import "Over.h" 
#import "RootViewController.h" 
#import <CoreData/CoreData.h> 
#import "NewKeywordViewController.h" 

@interface Home : UIViewController { 

//UI Button instance variable 
UIButton *tweetButton; 



} 

// Properties 
@property (nonatomic, strong) IBOutlet UIButton *tweetButton; 




// Methods 
-(IBAction)sendTweet:(id)sender; 
-(IBAction)vacatures; 
-(IBAction)zoeken; 
-(IBAction)Over; 

与.m文件:

#import "Home.h" 
#import "RootViewController.h" 
#import "Reachability.h" 
#import "AppDelegate.h" 
#import "MapViewController.h" 
#import "InfoViewController.h" 
#import "Keyword.h" 





@interface Home() 

@end 

@implementation Home 

@synthesize tweetButton; 




-(IBAction)vacatures { 

    VacaturesViewController *screen = [[VacaturesViewController alloc] initWithNibName:nil  bundle:nil]; 
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:screen animated:YES]; 


} 

-(IBAction)zoeken { 

RootViewController *screen = [[[RootViewController alloc] initWithNibName:nil bundle:nil] autorelease]; 
[self presentModalViewController:screen animated:YES]; 

} 

-(IBAction)Over { 

Over *screen = [[Over alloc] initWithNibName:nil bundle:nil]; 
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:screen animated:YES]; 


} 





-(IBAction)sendTweet:(id)sender 
{ 
NSString *tweet = [[NSString alloc] initWithString:@"Door de Thuiszorg applicatie heb ik altijd de juiste zorg in de buurt! Downloaden dus!"]; // Creates the string that is used for the tweet. 
{ 
    TWTweetComposeViewController *tweeter = [[TWTweetComposeViewController alloc] init]; // Allocates and initialises the Tweet "view". 
    [tweeter setInitialText:tweet]; // Sets the text of the tweet to be that of the NSString *tweet 
    [self presentModalViewController:tweeter animated:YES]; //Present the Tweet view to the user. 
} 
} 

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 



    // Do any additional setup after loading the view, typically from a nib. 
} 

- (void)viewDidUnload 
{ 
[super viewDidUnload]; 
// Release any retained subviews of the main view. 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation 
{ 
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 
} 



@end 

我希望你能帮助我的人!

+0

方法' - (IBAction为)Over'和类名'Over'都是相同的,请让他们不同 – 2012-04-23 12:36:07

+0

Aalok您好:感谢您!我改变了它。但问题与'zoeken'有关。当我按下按钮去RootViewController只显示我一个位置应用程序的表,它不会做任何事情后: – 2012-04-23 12:44:13

+0

检查出你的xib哪个视图绑定到文件的所有者参考文件的外观 – 2012-04-23 12:57:05

回答

0

改变这种

-(IBAction)Over { 

Over *screen = [[Over alloc] initWithNibName:nil bundle:nil]; 
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:screen animated:YES]; 


} 

这个

-(IBAction)OverView { 

Over *screen = [[Over alloc] initWithNibName:nil bundle:nil]; 
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:screen animated:YES]; 


} 

并连接按钮动作“概述”反对过度

+0

嗨时石,谢谢你,我已经这样做了。但是这并不能解决我对Rootview控制器的问题? – 2012-04-23 12:55:35

+0

好吧,这里有一些关于我的问题的更多信息! 查看Screenshot_1 http://www.de3kwasten.nl/Screenshot_1.png这是主要的应用程序,当我点击Zoeken de黄色/橙色按钮时,它会转到Rootviewcontroller,它看起来像这样.http://www.de3kwasten。 nl/Screenshot_2.png但它需要看起来像这样..http://www.de3kwasten.nl/Screenshot_3.png,它在界面生成器中是这样制作的?请有人帮助我! – 2012-04-23 13:04:42

+0

你正在调用UITableView而不是RootController viewController * vc = [[ViewController alloc] initWithNibName:@“yourViewControllerXibName”bundle:nil]; [self.navigationController presentModalViewController:vc animated:YES]; – chewy 2012-04-23 13:15:45

2

你可以简单地做这个改变你的根视图控制器。

Over *screen = [[Over alloc] initWithNibName:@"Over" bundle:nil]; 
[[AppDelegate application].window.rootViewController = over;