我是新來的客觀c編程,我正在製作一個應用程序。我使用的是osx 10.8.4和xcode 4.6。我試圖(模態)從單視圖應用程序中的一個視圖控制器切換到另一個視圖控制器。我已經給了segue的segue標識符,並在storyboard中放置了一個segue。然而,當我嘗試Segue公司控制檯顯示此:警告:嘗試在<ViewController:0x82b25a0>上呈現其視圖不在窗口層次結構中的<UIViewController:0x74acff0>
Warning: Attempt to present <UIViewController: 0x74acff0> on <ViewController: 0x82b25a0> whose view is not in the window hierarchy!
這是我爲我的第一個視圖控制器.m文件代碼(包含的代碼Segue公司):
Viewcontroller.m:
#import "ViewController.h"
#import "hackScreen.h"
#import "AppDelegate.h"
#import <RevMobAds/RevMobAds.h>
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)hackStarter:(id)sender {
NSString *checker = [_redBoulderRepublic text];
int soLong = [checker length];
UIAlertView *wrongNumber = [[UIAlertView alloc]
initWithTitle:@"Invalid number"
message:@"Please enter a valid phone number"
delegate:nil
cancelButtonTitle:@"dismiss"
otherButtonTitles:nil];
if (soLong == 10){
[self performSegueWithIdentifier:@"SegueOne" sender:sender];
}
else{
[wrongNumber show];
}
}
- (void)dealloc {
[_redBoulderRepublic release];
[super dealloc];
}
- (IBAction)keyboardKiller:(id)sender {
[_redBoulderRepublic resignFirstResponder];
}
@end
我的.h文件中:
Viewcontroller.h:
#import <UIKit/UIKit.h>
#import <RevMobAds/RevMobAds.h>
#import "AppDelegate.h"
#import "hackScreen.h"
@interface ViewController : UIViewController
- (IBAction)hackStarter:(id)sender;
@property (retain, nonatomic) IBOutlet UITextField *redBoulderRepublic;
- (IBAction)keyboardKiller:(id)sender;
@end
你可以添加故事板的圖片嗎? –
當您執行搜索時,屏幕上是否有除ViewController的視圖之外的其他內容? – rdelmar
我無法添加圖片,因爲我沒有足夠的代表 –