【发布时间】:2015-10-28 22:39:15
【问题描述】:
我正在使用SWViewController Library。实现库时,我的 frontViewController 出现了,但我的 backViewController 是黑色的。我不知道是什么导致了这个问题,并且可以使用一些帮助。该应用程序完全使用 Objective C 编程。该应用程序没有 swift 也没有情节提要。
这是我的 backViewController.h 代码:
#import <UIKit/UIKit.h>
@interface RearViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, retain) IBOutlet UITableView *rearTableView;
@end
rearViewController.m:
#import "RearViewController.h"
#import "SWRevealViewController.h"
@interface RearViewController()
{
NSInteger _presentedRow;
}
@end
@implementation RearViewController
@synthesize rearTableView = _rearTableView;
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"Rear View", nil);
}
我的 appDelegate.h 代码:
@class SWRevealViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) TARootViewController *rootViewController;
@property (strong, nonatomic) SWRevealViewController *viewController;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
@end
还有我的 appDelegate.m 代码:
#import "AppDelegate.h"
#import "SWRevealViewController.h"
#import "RearViewController.h"
@interface AppDelegate()<SWRevealViewControllerDelegate>
@end
@implementation AppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window = window;
RearViewController *rearViewController = [[RearViewController alloc] init];
TARootViewController *frontViewController = [[TARootViewController alloc] init];
SWRevealViewController *revealController = [[SWRevealViewController alloc] initWithRearViewController:rearViewController frontViewController:frontViewController];
revealController.delegate = self;
self.window.rootViewController = revealController;
[self.window makeKeyAndVisible];
if (self.rootViewController.activeViewController == nil) {
[[TAActiveUserManager sharedManager] startOrResumeAppSession];
}
// Register device for push notifications
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
return YES;
}
there is more here but it's not relevant to initializing the viewcontrollers
【问题讨论】:
-
我正在使用断点进行调试,并在 viewDidLoad 函数结束之前在 RearViewController.m 中设置断点返回的值不是 nil,这意味着视图确实存在于内存中的某个位置
-
在这方面 SWRevealController 库似乎存在一些问题。谷歌搜索结果:
Had the same issue. Setting revealAnimationType = SWRevealToggleAnimationTypeEaseOut fixes it but I liked SWRevealToggleAnimationTypeSpring better. -
这似乎是旧版本库的过时修复。更改库中默认属性列表中的属性并没有解决这个问题。
-
link 问题
标签: ios objective-c iphone swrevealviewcontroller