我正在使用 GMGridview 的应用程序中工作。我在 cellforItems 方法中添加了按钮。-
(GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index
{
NSLog(@"Creating view indx %d", index);
CGSize size = [self GMGridView:gridView sizeForItemsInInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]];
GMGridViewCell *cell = [gridView dequeueReusableCell];
if (!cell)
{
cell = [[GMGridViewCell alloc] init];
cell.deleteButtonIcon = [UIImage imageNamed:@"close_x.png"];
cell.deleteButtonOffset = CGPointMake(-15, -15);
}
[[cell.contentView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setTag:index];
[btn setFrame:CGRectMake(0, 0,size.width, size.height)];
NSLog(@"button frame is %@",btn);
[[btn layer] setBorderColor:[UIColor redColor].CGColor];
[[btn layer]setBorderWidth:2.0f];
[btn addTarget:self action:@selector(SegmentChange:) forControlEvents:UIControlEventTouchUpInside];
cell.contentView = btn;
//int btntag=btn.tag;
return cell;
然后我已经使用该方法翻转所有按钮,但它不起作用,我想要的是当我单击翻转按钮时,gridview 中的所有按钮都应该翻转。我该怎么做,我使用的翻转代码在这里,
for(ll=0;ll<[Image_array count];ll++)
{
// [UIView setAnimationDelay:2.0];
[UIView beginAnimations:@"BackButton" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:12.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:btn cache:YES];
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
[btn setImage:[UIImage imageNamed:nil] forState:UIControlStateNormal];
[arr_check replaceObjectAtIndex:ll withObject:@"uncheck"];
front = NO;
}
[_gmGridView reloadData];