lundi 30 mars 2015

NativeCalAppDelegate (Kal calendar) does display my own view controller


Vote count:

0




I have tried out the Kal calendar and it works fine but when I try the NativeCal example I can't make it work if I want to display my own viewcontroller first.


Thus I am trying to display my main viewcontroller named "ViewController" embedden in the navigationcontroller but once launched it goes directly to the calendarrviewcontroller (Kal).


If I put the following didFinishLaunchingWithOptions instead of applicationDidFinishLaunching I manage to display my viewcontroller but then the calendar does not work as it should (does not show the events).


Please help me out.


I have pasted the code I'm using here beneath:



@implementation NativeCalAppDelegate

@synthesize window;



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

return YES;
}

- (void)applicationDidFinishLaunching:(UIApplication *)application

{


kal = [[KalViewController alloc] initWithSelectionMode:KalSelectionModeSingle];
kal.selectedDate = [NSDate dateStartOfDay:[[NSDate date] offsetDay:1]];

kal.title = @"Calendar";



kal.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Today", @"") style:UIBarButtonItemStylePlain target:self action:@selector(showAndSelectToday)];
kal.delegate = self;
dataSource = [[EventKitDataSource alloc] init];
kal.dataSource = dataSource;
kal.minAvailableDate = [NSDate dateStartOfDay:[[NSDate date] offsetDay:-5]];
kal.maxAVailableDate = [kal.minAvailableDate offsetDay:30];



navController = [[UINavigationController alloc] initWithRootViewController:kal];
window.rootViewController = navController;
[window makeKeyAndVisible];
}


- (void)showAndSelectToday
{
[kal showAndSelectDate:[NSDate date]];
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

EKEventViewController *vc = [[EKEventViewController alloc] init];
vc.event = [dataSource eventAtIndexPath:indexPath];
vc.allowsEditing = NO;
[navController pushViewController:vc animated:YES];
}


@end


asked 31 secs ago







NativeCalAppDelegate (Kal calendar) does display my own view controller

Aucun commentaire:

Enregistrer un commentaire