- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我刚刚学习 Objective C 编程,但我一直在从 .ics 文件中获取信息以显示在我的表格 View 上。
表格 View 工作正常。我已经尝试过将信息直接存储到 NSArray 中。单击标题时我会看到详细信息 View 。
当我尝试从 .ics 文件中获取信息时,我什至没有显示标题。我只是得到一个空窗口。
#import "RootViewController.h"
#import "DetailedInformationView.h"
@implementation RootViewController
@synthesize dataArray;
@synthesize ical;
#pragma mark -
#pragma mark View lifecycle
-(id)init{
if (self = [super init]) {
dataArray = [[NSMutableArray alloc]init];
NSString *path = [[NSBundle mainBundle] pathForResource:@"timeedit" ofType:@"ics"];
NSDictionary *dict = [NSDictionary dictionaryWithObject: path forKey:@"Calendar app"];
[dataArray addObject:dict];
NSLog(@"init");
self.navigationItem.title = @"Calendar App";
}
return self;
}
-(NSMutableArray*)parseCalendarWithString:(NSString*)_file{
//NSMutableArray *parse = [[NSMutableArray alloc] initWithCapacity:[self count]];
}
-(NSMutableArray*)parseCalendarWithPath:(NSString*)_path{
//NSString *path = [[NSBundle mainBundle] pathForResource:@"timeedit" ofType:@"ics"];
//NSDictionary *dict = [[NSDictionary alloc] initWithPath: path];
//self.dataArray = [NSArray: dict ];
//[dict release];
//return ;
}
-(void)sortArray:(NSMutableArray*)_array by:(iCalSortBy)_by{
//dataArray = [[NSMutableArray alloc]init];
//NSMutableArray *array = [[dataArray alloc]sortedArrayUsingSelector::@selector(compare:)];
//self.dataArray = array;
}
- (void)viewDidLoad {
[self init];
//self.dataArray = [NSArray arrayWithObjects:@"One", @"Two", @"Three", nil];
//ical = [[iCalParser alloc] initWithPath:@"timeedit"];
//self.dataArray = [NSMutableArray arrayWithContentsOfFile:path];
//NSString *path = [[NSBundle mainBundle] pathForResource:@"timeedit" ofType:@"ics"];
//NSDictionary *dict = [[NSDictionary alloc] initWithPath: path];
//self.dataArray = [NSArray arrayWithObjects:dict, nil];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
[super viewDidLoad];
}
/*
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
*/
/*
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
*/
/*
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
}
*/
/*
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
#pragma mark -
#pragma mark Table view data source
// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if(section == 0){
return @"Monday";
}
else if (section == 1){
return @"Tuesday";
}
else if (section == 2){
return @"Wednesday";
}
else if (section == 3){
return @"Thursday";
}
else if (section == 4){
return @"Friday";
}
else if (section == 5){
return @"Saturday";
}
else if (section == 6){
return @"Sunday";
}
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSDictionary *dict = [dataArray objectAtIndex:section];
NSArray *data = [dict objectForKey:@"Calendar App"];
return [data count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
NSDictionary *dict = [dataArray objectAtIndex:indexPath.section];
NSArray *data = [dict objectForKey:@"Calendar App"];
NSString *cellValue = [data objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
NSLog(@"Conf Cell");
//cell.textLabel.text = [NSString stringWithFormat:@"%@", [dataArray objectAtIndex: indexPath.row]];
//cell.textLabel.text = [[ical libraryItemAtIndex:indexPath.row] valueForKey:@"DTSTART"];
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source.
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *dict = [dataArray objectAtIndex:indexPath.section];
NSArray *data = [dict objectForKey:@"Countries"];
NSString *selectedrow = [data objectAtIndex:indexPath.row];
DetailedInformationView *detailView = [[DetailedInformationView alloc] initWithNibName:@"DetailedInformationView" bundle:nil];
detailView.selectedrow = selectedrow;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailView animated:YES];
[[detailView label] setText:[NSString stringWithFormat:@"%@", [dataArray objectAtIndex:indexPath.row]]];
[detailView release];
detailView = nil;
}
#pragma mark -
#pragma mark Memory management
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Relinquish ownership any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
// For example: self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
[dataArray release];
}
@end
最佳答案
我猜你的问题是这样的:
NSString *path = [[NSBundle mainBundle] pathForResource:@"timeedit" ofType:@"ics"];
NSDictionary *dict = [NSDictionary dictionaryWithObject: path forKey:@"Calendar app"];
iCal 文件 (.ics) 不是属性列表格式的 xml 文件,这意味着它应该返回 nil
。您应该找到一种不同的方式来读取 iCal 文件。
关于objective-c - .ics 文件的 PathforResource 问题, Objective-C ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4075779/
如何防止我的仅 ICS 小部件出现在旧手机上,同时仍然保持我的应用程序向后兼容。目前,我的任务管理器在 froyo 及更高版本上运行,但我有一个 ICS 和更高版本的小部件,我只想向兼容用户显示。 最
我遇到一个问题,加载动画(5 个连续点从左向右移动)在 ICS 后设备中不起作用,但在 ICS 前设备中完美运行。我尝试在两者中复制调用动画的相同方法,但它似乎不起作用。 提前致谢, 阿曼尼·斯旺
我刚刚查看了 Ice Cream Sandwich 源代码,因为我正在尝试将 Holo 主题移植到所有 4.0 之前的设备。 我使用了很多有用的工具: 操作栏:ActionBarSherlock IC
我正在从 C# WPF 应用程序创建 ICS 文件并使用以下代码生成 ICS 文件。 StreamWriter writer; writer = new StreamWriter(filePath);
有没有办法在应用程序中的非 ICS android 手机上获得 android ICS 控件?例如,我已经看到 echofone 或其他一些使用 ICS 控件的应用程序,这些应用程序在低于 ICS (
我的应用创建了一个 ICS 文件,并将其作为 mimeType:@"text/calendar" 类型的电子邮件附件发送。 在 iOS6 中一切都运行完美。如果设备有 iOS7,电子邮件的附件 .IC
在我的应用程序中,我使用一些对话框来显示信息。我的应用程序的主题是 Theme.Light 从 2 年开始,这些对话框从一开始就一直是黑色的。 现在有了 ICS,Google 似乎只是改变了主意,将这
我们正在从 Java 代码生成一个 ICS 文件,并最初以 UTC 格式输入时间。 我们发现,在创建定期约会时,如果第一个日期和最后一个日期之间的 DST 发生变化,一些 session 会在正确时间
嗨,我刚刚发现了 ics 文件格式,我想知道是否可以在事件条目中包含一个或两个警报点,这些警报点将自动被拾取? 代码: BEGIN:VEVENT DTSTART;TZID=Europe/Amsterd
我正在使用 ASP.NET 创建一个 ics 文件,用于将假日导入 Outlook 2007 并尝试设置全天事件标志。这在多日假期中效果很好,但对于单日假期,它似乎没有注册,我只是得到了从午夜到午夜预
这个问题已经有答案了: 已关闭11 年前。 Possible Duplicate: Strange NetworkOnMainThreadException in Android app? Tryin
我制作了一个 ICS 提要,其中包含一长串事件。我的时区似乎不起作用。 在下面的示例中,您会看到我的事件应于 07:55:00 开始并于 09:30:00 结束。这就是我的日历中应该显示的内容。相反,
我们为我们的外联网开发了一个日历。每周我们都会为学校的所有师生更新下周的类(class)安排。这也会触发向选择该选项的用户发送每封电子邮件的 ICS 文件。 现在,几乎总是会发生最后一刻的更改,因此需
我正在为公司使用 JavaScript 开发 EPUB 阅读器,该应用程序在 Android 2.2 上运行良好,但当我在 ICS 和 HoneyCom 上尝试时,JavaScript 无法正常运行。
我有一项 Activity ,其中的 ListView 来自网络。在加载数据时,我想显示一个进度对话框而不是 ListView 。 我的布局: 我这样做是为了让进度条自行显示(
我熟悉android 2.2,一直在做手机开发,那么ICS平板开发该从何入手呢?我从 quick-google 学到的主要内容是,现在我必须将 fragment 用于多 Pane 布局,而不仅仅是 A
我试着读出所有现有的日历。我试过这里的例子: http://developer.android.com/guide/topics/providers/calendar-provider.html 但我
我正在尝试在模拟器上测试 ICS 的加密功能。 为了启用“加密电话”,我们运行“telnet localhost 5554”,然后运行“power capacity 100”。 在此之后,当我单击“加
我已设置 android:targetSdkVersion=15 并将 SDK 构建为 15,同时假设该应用程序将使用来自 ICS 的新的好日期选择器,而在 2.x 设备上它将使用旧的讨厌的日期选择器
我在我的 Skyrocket 设备和模拟器上的 Android ICS 浏览器中发现了一个奇怪的错误。基本上,我拥有的固定 header 几乎失去了所有样式(恢复为文本,尽管它看起来仍然是固定的)。当
我是一名优秀的程序员,十分优秀!