2011-06-14 109 views
0

这可能是一个非常愚蠢的错误,但我花了超过4天的时间寻找解决方案。在MainWindow.xib中加载视图.xib

这很简单,我有我的MainView.xib和一个名为FirstViewController(h/m/xib)的视图。

在MainWindow.xib中,我添加一个UIViewController并将类名更改为FirstViewController并设置了Nib名称(altouhg,我试过两种方法)。

我想它必须做一些事情,但我不能告诉,因为我是一个iOS开发新手,任何帮助都会非常有帮助。

进出口使用的XCode 3.2和Interface Builder,与SDK 4.3

的AppDelegate

#import <UIKit/UIKit.h> 
#import <CoreLocation/CoreLocation.h> 


@interface iPadTerritorioV2AppDelegate : NSObject <UIApplicationDelegate> { 

    IBOutlet UIWindow *window; 
    IBOutlet UIViewController *navigationController; 

    NSString *devToken; 

    NSString *matricula; 
    NSString *campus; 

     NSMutableArray *materiasAlumno; //para CCM 
     NSMutableArray *busqDir; //para CCM 

    NSInteger agendaBadgeNumber; 
    NSInteger intramurosBadgeNumber; 
    NSInteger notificacionesBadgeNumber; 
    NSInteger mapaBadgeNumber; 

    NSMutableData *receivedData; 
    NSMutableDictionary *listData; 

    BOOL yaSeHizoElPrimerFetchBadges; 

} 

@property (nonatomic, retain) IBOutlet UIWindow *window; 
@property (nonatomic, retain) IBOutlet UIViewController *navigationController; 


@property (nonatomic, retain) NSString *devToken; 

@property (nonatomic, retain) NSString *matricula; 
@property (nonatomic, retain) NSString *campus; 

@property (nonatomic, retain) NSMutableArray *materiasAlumno; 
@property (nonatomic, retain) NSMutableArray *busqDir; 

@property NSInteger agendaBadgeNumber; 
@property NSInteger intramurosBadgeNumber; 
@property NSInteger notificacionesBadgeNumber; 
@property NSInteger mapaBadgeNumber; 

@property (nonatomic, retain) NSMutableData *receivedData; 
@property (nonatomic, retain) NSMutableDictionary *listData; 


@property BOOL yaSeHizoElPrimerFetchBadges; 

- (void)fetchBadges; 

@end 

FirstViewController.h

#import <UIKit/UIKit.h> 
#import "Constants.h" 
#import "StringDecoding.h" 

#define kConnectionBadgeNotifications 0 
#define kConnectionLogin    1 
#define kConnectionDevToken    2 

#define kCCMindex 0 
#define kCSFindex 1 
#define kMTYindex 2 

@interface FirstViewController : UIViewController { 

    IBOutlet UISegmentedControl *segmentedCampus; 
    IBOutlet UITextField *usernameField; 
    IBOutlet UITextField *passwordField; 
    IBOutlet UISwitch *remembermeSwitch; 
    IBOutlet UIButton *loginButton; 
    UIActivityIndicatorView *loginIndicator; 

    NSMutableDictionary *listData; 
    NSMutableData *receivedData; 
    NSInteger connectionID; 
} 

@property (nonatomic, retain) UISegmentedControl *segmentedCampus; 
@property (nonatomic, retain) UITextField *usernameField; 
@property (nonatomic, retain) UITextField *passwordField; 
@property (nonatomic, retain) UIActivityIndicatorView *loginIndicator; 
@property (nonatomic, retain) UISwitch *remembermeSwitch; 
@property (nonatomic, retain) UIButton *loginButton; 

@property (nonatomic, retain) NSMutableDictionary *listData; 
@property (nonatomic, retain) NSMutableData *receivedData; 
@property NSInteger connectionID; 

- (IBAction)handleNextClick:(id) sender; 
- (IBAction)backgroundClick; 
- (IBAction)login: (id) sender; 

@end 
+0

调用视图“xxxxxxController”按照惯例是坏的。 **这是一个视图,而不是控制器!**;) – 2011-06-14 21:40:51

+0

您是否尝试过在Xcode中从头开始创建基于视图的项目并查看其设置? – Dancreek 2011-06-14 21:41:24

+0

@WTP因为我基本上将iPhone应用程序移植到iPad,为了保持一致性,我坚持使用源文件的名称 – 2011-06-14 21:45:23

回答

0

这听起来像你FirstViewController不被保留 - 如果它是没有分配到任何地方的插座,没有东西保留它,它会消失。某处添加一个属性(AppDelegate中,也许,如果这就是你所得到),并连接到控制器:

@property (nonatomic, retain) IBOutlet UIViewController *firstViewController; 
+0

它现在只是崩溃了xD,让我在AppDelegate和FirstViewController上添加了什么 – 2011-06-14 22:17:40

+0

如果还不清楚的话,你需要在某个地方@synthesize那个属性。 – Thom 2011-06-14 22:21:55

+0

是的,我在AppDelegate.m中合成它 – 2011-06-14 22:31:41