這可能是一個非常愚蠢的錯誤,但我花了超過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
調用視圖「xxxxxxController」按照慣例是壞的。 **這是一個視圖,而不是控制器!**;) – 2011-06-14 21:40:51
您是否嘗試過在Xcode中從頭開始創建基於視圖的項目並查看其設置? – Dancreek 2011-06-14 21:41:24
@WTP因爲我基本上將iPhone應用程序移植到iPad,爲了保持一致性,我堅持使用源文件的名稱 – 2011-06-14 21:45:23