在MainWindow.xib中加载视图.xib

时间:2011-06-14 21:38:00

标签: iphone ios ipad uiview

这可能是一个非常愚蠢的错误,但我花了4天多时间寻找解决方案。

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

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

我想它必须与网点做点什么,但我真的不能说,因为我是iOS的新手,任何帮助都会真的帮助很多。

我正在使用XCode 3.2和界面构建器,以及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

1 个答案:

答案 0 :(得分:0)

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

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