0

我有 2 个不同的 xcode 项目。一个是主应用程序,它已准备好完整的设计等并切换一些屏幕。然后我有一个定位应用程序,可以显示附近的医院等。我想要它做的是,如果我在主应用程序中按下一个按钮,它就会进入定位应用程序。所以我把这两个项目合二为一。终于它工作了,但现在当试图将位置应用程序链接到它工作的按钮时,它没有向我显示全屏。它只是向我展示了一张包含医院、医生等的表格,但我想查看位置应用程序的全屏。我认为它是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

我希望你们能帮助我伙计们!

4

2 回答 2

2

您只需执行此操作即可更改根视图控制器。

 Over *screen = [[Over alloc] initWithNibName:@"Over" bundle:nil];
[[AppDelegate application].window.rootViewController = over;
于 2012-04-23T12:58:25.773 回答
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];


}

并将按钮操作连接到与 Over 相对的“OverView”

于 2012-04-23T12:43:51.310 回答