У меня есть два разных проекта 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
Я надеюсь, что вы можете помочь мне, ребята!
метод '- (IBAction) Over' и имя класса' Over' оба же, пожалуйста, сделать их разными –
Привет Aalok, спасибо! Я изменил его. Но проблема связана с битом «змейка». И когда я нажимаю кнопку, чтобы перейти в RootViewController, я показываю только таблицу приложения местоположения, и после этого он ничего не делает :( –
проверить свой xib, представление которого привязано к -view ссылки владельца файла out12ate –