Ios7 进程未显示在ios 7的UITable单元格中
进程未显示在ios 7的UITableCell中。 此代码适用于ios 6.1.3,但不适用于ios 7 # 此代码适用于ios 6.1.3Ios7 进程未显示在ios 7的UITable单元格中,ios7,Ios7,进程未显示在ios 7的UITableCell中。 此代码适用于ios 6.1.3,但不适用于ios 7 # 此代码适用于ios 6.1.3 -(void)updateFileProgress:(NSNotification *)notification { NSArray *indexAndProgress = [notification object]; NSString *file = [indexAndProgress objectAtIndex:0]; floa
-(void)updateFileProgress:(NSNotification *)notification {
NSArray *indexAndProgress = [notification object];
NSString *file = [indexAndProgress objectAtIndex:0];
float progress = [[indexAndProgress objectAtIndex:1] floatValue];
int index = [[Data sharedData] indexOfBookFileName:file];
[[Data sharedData] persentDone:[NSNumber numberWithFloat:progress] inBookIndex:[NSNumber numberWithInt:index]];
if(!searching) {
int bookIndex = index;
int row = -1;
if(iPad) row = (bookIndex / (orientation ? 5:6));
else row = (bookIndex / (orientation ? 3:4));
NSArray *indexPathes = [booksTable indexPathsForVisibleRows];
UIButton *fbutton = nil;
for(NSIndexPath *indexPath in indexPathes)
{
if(indexPath.row == row)
{
UITableViewCell *cell = [booksTable cellForRowAtIndexPath:indexPath];
for (UIButton *button in [cell subviews])
{
if([button isKindOfClass:[UIButton class]] && button.tag == bookIndex)
{
fbutton = button;
break;
}
}
break;
}
}
NSLog(@"fbutton = %@", fbutton);
if(fbutton) {
UIProgressView *currentProgressView = (UIProgressView *)[fbutton viewWithTag:tPROGRESS_VIEW];
if(currentProgressView)
{
currentProgressView.progress = progress;
} else {
currentProgressView = [[[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault] autorelease];
currentProgressView.frame = CGRectMake(5 , fbutton.frame.size.height - 10, fbutton.frame.size.width-10, 6);
currentProgressView.tag = tPROGRESS_VIEW;
currentProgressView.progress = progress;
NSLog(@"add subview to button");
[fbutton addSubview:currentProgressView];
}
if(progress == 0 || progress >= 1 || progress < 0)
{
[currentProgressView removeFromSuperview];
[[Data sharedData] performSelector:@selector(refreshBookList) withObject:nil afterDelay:1];
[[Data sharedData] refreshBookList];
}
}
}
}
#
然后我将代码更改为:
for (UIButton *button in [[cell.subviews lastObject] subviews]) {
if([button isKindOfClass:[UIButton class]] && button.tag == bookIndex) {
fbutton = button;
break;
}
}
此代码返回UICellButton,但UIProgress未在表单元格中显示 布林托夫朗没有帮助 帮帮我
for (UIButton *button in [[cell.subviews lastObject] subviews]) {
if([button isKindOfClass:[UIButton class]] && button.tag == bookIndex) {
fbutton = button;
break;
}
}