我有一个AQGridView
设置来显示文档目录中的文件以及其他 4 个预定义并在启动时加载到表中的文档。我需要知道如何设置单元格来保存文档的 URL(是的,甚至是预定义的 URL!毕竟它们都是NSStrings
。)所以以后可以调用它
- (void)gridView:(AQGridView *)gridView didSelectItemAtIndex:(NSUInteger)index {
NSString *fileURL = [self._icons objectAtIndex:index];
// do stuff
}
-(id)init
并使用自定义方法加载到新视图中。现在,NSLog
文档目录对象单元格的an在日志中返回(NULL)
, 和。SIGABRT
好的,赏金来了。我想这意味着我可以要求一点质量。代码片段会很棒!
可根据要求提供代码。
编辑工作代码:
//.h
NSMutableArray *_documentIconsURLs;
//.m
//viewDidLoad
// array for internal and external document URLs
self._documentIconsURLs = [NSMutableArray array];
_documentIconsURLs = [[NSMutableArray alloc] initWithObjects:@"Musette.pdf",
@"Minore.pdf",
@"Cantata.pdf",
@"Finalé.pdf",
@"divine-comedy-inferno.pdf", nil];
//didSelectObject
- (void) gridView:(AQGridView *)gridView didSelectItemAtIndex:(NSUInteger)index {
NSLog (@"Selected theArgument=%d\n", index);
UIViewController *viewController = [[[UIViewController alloc]init]autorelease];
{
//if file is built-in, read from the bundle
if (index <= 4)
{
// first section is our build-in documents
NSString *fileURLs = [_documentIconsURLs objectAtIndex:index];
NSLog(@"%@", fileURLs);
viewController = [[[viewController alloc]initWithContentURL:fileURLs]autorelease];
}