2012-04-23 3 views
0

У меня есть два разных проекта 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' оба же, пожалуйста, сделать их разными –

+0

Привет Aalok, спасибо! Я изменил его. Но проблема связана с битом «змейка». И когда я нажимаю кнопку, чтобы перейти в RootViewController, я показываю только таблицу приложения местоположения, и после этого он ничего не делает :( –

+0

проверить свой xib, представление которого привязано к -view ссылки владельца файла out12ate –

ответ

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]; 


} 

и связывают действие кнопки с «OverView» противостоящие За

+0

Привет, Ши Ши, спасибо, я сделал это. Но это не устраняет мою проблему с Rootviewcontroller? –

+0

Хорошо, ребята, вот еще информация о моей проблеме! См. «Скриншот_1» http://www.de3kwasten.nl/Screenshot_1.png Это основное приложение, и когда я нажимаю кнопку Zoeken de yellow/orange, он переходит к контроллеру Rootview, который выглядит так: http: //www.de3kwasten. nl/Screenshot_2.png Но это должно выглядеть так: http: //www.de3kwasten.nl/Screenshot_3.png, и это сделано так в построителе интерфейса? Пожалуйста, помогите мне! –

+0

вы вызываете UITableView, а не RootController viewController * vc = [[Распределение ViewController] initWithNibName: @ "yourViewControllerXibName" bundle: nil]; [self.navigationController presentModalViewController: vc animated: YES]; – chewy

2

Вы можете изменить корневой контроллер представления просто делая это.

Over *screen = [[Over alloc] initWithNibName:@"Over" bundle:nil]; 
[[AppDelegate application].window.rootViewController = over; 
Смежные вопросы