Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从事件工具包解析事件标题_Ios_Objective C_Iphone_Xcode_Swift - Fatal编程技术网

Ios 从事件工具包解析事件标题

Ios 从事件工具包解析事件标题,ios,objective-c,iphone,xcode,swift,Ios,Objective C,Iphone,Xcode,Swift,因此,我想从我订阅的日历中读取我的事件数组。 这些活动都有类似的格式,例如有两个模块,“生命的意义”和“长跑”: 谈话:生命的意义 谈话:长跑 谈话:生命的意义 谈话:生命的意义 谈话:长跑 我希望能够使用类似 [[event.title componentsSeparatedByString:@"Talk: "] objectAtIndex:i]; 因此,在我的表格视图中,我可以有一个“生命的意义”单元和一个“长跑”单元。然后选择一个,你就可以看到该模块的所有“对话”。还有其他类别,如“研讨

因此,我想从我订阅的日历中读取我的事件数组。 这些活动都有类似的格式,例如有两个模块,“生命的意义”和“长跑”:

谈话:生命的意义

谈话:长跑

谈话:生命的意义

谈话:生命的意义

谈话:长跑

我希望能够使用类似

[[event.title componentsSeparatedByString:@"Talk: "] objectAtIndex:i];
因此,在我的表格视图中,我可以有一个“生命的意义”单元和一个“长跑”单元。然后选择一个,你就可以看到该模块的所有“对话”。还有其他类别,如“研讨会”和“实践”

目前,我只显示所有事件的代码如下(忽略获取所选日历的事件并生成一个名为arevents的数组)


感谢您花时间阅读:)

最后,我通过修改生成它的类中的欠费事件对它进行了排序。我可以检查它是否包含字符串“Talk:”,然后他们删除该位,还可以检查Arrents是否已经包含标题,然后不添加重复项

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TableIDCell"];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TableIDCell"];
}

// Get each single event.
EKEvent *event = [self.arrEvents objectAtIndex:indexPath.row];

// Set its title to the cell's text label.
cell.textLabel.text = event.title;

// Get the event start date as a string value.
NSString *startDateString = [self.appDelegate.eventManager getStringFromDate:event.startDate];

// Get the event end date as a string value.
NSString *endDateString = [self.appDelegate.eventManager getStringFromDate:event.endDate];

// Add the start and end date strings to the detail text label.
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ - %@", startDateString, endDateString];

if (indexPath.row%2 == 0) {
    UIColor *altCellColor = [UIColor colorWithWhite:0.7 alpha:0.1];
    cell.backgroundColor = altCellColor;
}

return cell;
}