首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >切换到RootViewController

切换到RootViewController
EN

Stack Overflow用户
提问于 2012-04-23 20:30:27
回答 2查看 252关注 0票数 0

我有两个不同的xcode项目。一个是主应用程序,它已经准备好了完整的设计,并切换了一些屏幕。然后我有一个定位应用程序,它可以向你显示附近的医院等。我想要它做的是,如果我在主应用程序中按下一个按钮,它就会进入定位应用程序。因此,我将这两个项目合并为一个。最后,它起作用了,但现在,当尝试将定位应用程序链接到按钮时,它起作用了,但它不能全屏显示。它只给我显示了一张有医院、医生等的桌子,但我想要看到定位应用程序的全屏幕。我还以为是rootviewcontroller呢。代码如下:

.h文件

代码语言:javascript
复制
#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文件:

代码语言:javascript
复制
#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

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

EN

回答 2

Stack Overflow用户

发布于 2012-04-23 20:58:26

您可以简单地通过执行此操作来更改根视图控制器。

代码语言:javascript
复制
 Over *screen = [[Over alloc] initWithNibName:@"Over" bundle:nil];
[[AppDelegate application].window.rootViewController = over;
票数 2
EN

Stack Overflow用户

发布于 2012-04-23 20:43:51

改变这一点

代码语言:javascript
复制
-(IBAction)Over {

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


}

到这个

代码语言:javascript
复制
-(IBAction)OverView {

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


}

并将按钮操作连接到与Over相反的"OverView“

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10280577

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档