1
创建自定义AQGridViewCell像这样:AQGridView选择单元格
- (AQGridViewCell *) gridView: (AQGridView *) aGridView cellForItemAtIndex: (NSUInteger) index
{
static NSString * PlainCellIdentifier = @"PlainCellIdentifier";
GridViewCell * cell = (GridViewCell *)[aGridView dequeueReusableCellWithIdentifier:@"PlainCellIdentifier"];
if (cell == nil)
{
cell = [[GridViewCell alloc] initWithFrame: CGRectMake(3.333, 3.3336, 100, 100)
reuseIdentifier: PlainCellIdentifier];
}
NSString *stringURL = [[featuredStories objectAtIndex:index] objectAtIndex:1];
NSLog(@"stringURL: %@", stringURL);
NSURL *url = [NSURL URLWithString:stringURL];
[cell.imageView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"example0.png"]];
cell.storyID = [[featuredStories objectAtIndex:index] objectAtIndex:0];
return cell;
}
,我已经添加的方法,当你选择像这样的小区:
- (void) gridView:(AQGridView *)gridView didSelectItemAtIndex:(NSUInteger)index {
//I want to NSLog the cell.storyID here
NSLog (@"Selected theArgument=%d\n", index);
}
我怎么去访问storyID
在cell
内gridView:(AQGridView *)gridView didSelectItemAtIndex:(NSUInteger)index
?
真棒非常感谢!这是我失踪的演员。 – mkral
好的,一个简单的问题。如果我在'didSelect ...中执行Segue',但是我想用'storyID'准备Segue',那么我怎样才能从'prepare'方法中获得'index'呢? – mkral
没关系,我决定使用Segues进行报废,并以编程方式完成所有工作。 – mkral