gpt4 book ai didi

iphone - 谷歌日历在 iPhone 上的实现?

转载 作者:行者123 更新时间:2023-11-29 11:10:11 24 4
gpt4 key购买 nike

我想使用 GData 在 iPhone 上实现 Google 日历 GridView 链接。所以我成功地通过 GData 实现并访问了我的 Google 帐户。但是我可以看到 TableView 结构中的所有事件...我想要的结构如以下屏幕截图所示。

enter image description here

我怎样才能得到这个 View ?

我从 this link 下载了演示应用程序.

最佳答案

嗨,有没有一个第三方 API 可以像那样显示日历......

我在这里展示一些代码

实现一周,

- (MAEvent *)event {
static int counter;

NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];

[dict setObject:[NSString stringWithFormat:@"number %i", counter++] forKey:@"test"];

MAEvent *event = [[MAEvent alloc] init];
event.backgroundColor = [UIColor purpleColor];
event.textColor = [UIColor whiteColor];
event.allDay = NO;
event.userInfo = dict;
return event;
}


- (void)weekView:(MAWeekView *)weekView eventTapped:(MAEvent *)event {
NSDateComponents *components = [CURRENT_CALENDAR components:DATE_COMPONENTS fromDate:event.start];
NSString *eventInfo = [NSString stringWithFormat:@"Hour %i. Userinfo: %@", [components hour], [event.userInfo objectForKey:@"test"]];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:event.title
message:eventInfo delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}

Day.. 的实现tatic NSDate *date = nil;

- (NSArray *)dayView:(MADayView *)dayView eventsForDate:(NSDate *)startDate 
{
date = startDate;

NSArray *arr = [NSArray arrayWithObjects: self.event, self.event, self.event,
self.event, self.event, self.event, self.event, self.event, self.event, nil];
static size_t generateAllDayEvents;

generateAllDayEvents++;

if (generateAllDayEvents % 4 == 0)
{
((MAEvent *) [arr objectAtIndex:0]).title = @"All-day events test";
((MAEvent *) [arr objectAtIndex:0]).allDay = YES;
((MAEvent *) [arr objectAtIndex:1]).title = @"All-day events test";
((MAEvent *) [arr objectAtIndex:1]).allDay = YES;
}
return arr;
}

- (MAEvent *)event {
static int counter;
static BOOL flag;

NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];

[dict setObject:[NSString stringWithFormat:@"number %i", counter++] forKey:@"test"];

unsigned int r = arc4random() % 24;
int rr = arc4random() % 3;

MAEvent *event = [[MAEvent alloc] init];
event.backgroundColor = ((flag = !flag) ? [UIColor purpleColor] : [UIColor brownColor]);
event.textColor = [UIColor whiteColor];
event.allDay = NO;
event.userInfo = dict;

if (rr == 0) {
event.title = @"Event lorem ipsum es dolor test. This a long text, which should clip the event view bounds.";
} else if (rr == 1) {
event.title = @"Foobar.";
} else {
event.title = @"Dolor test.";
}

NSDateComponents *components = [CURRENT_CALENDAR components:DATE_COMPONENTS fromDate:date];
[components setHour:r];
[components setMinute:0];
[components setSecond:0];

event.start = [CURRENT_CALENDAR dateFromComponents:components];

[components setHour:r+rr];
[components setMinute:0];

event.end = [CURRENT_CALENDAR dateFromComponents:components];

return event;
}

关于iphone - 谷歌日历在 iPhone 上的实现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11927955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com