-(void)photoBrowser:(NSString*)uid Cid:(NSString*)cid{
MWPhoto *photo;
NSMutableArray *photos = [[NSMutableArray alloc] init];
int pageTotal =[[comicDetailDictionary objectForKey:@"pagetotal"]intValue];
NSString * format = @"%@/%04d.jpg";
for (int i=0; i< pageTotal; i++)
{
NSString * path=IfNullToString([comicDetailDictionary objectForKey:kDisplayBoardUrl]);
NSString * string=[[NSString stringWithFormat:@"%@",kBasePath] stringByAppendingString:[path stringByDeletingLastPathComponent]];
int pageIndex=[path stringByDeletingPathExtension].lastPathComponent.intValue;
photo = [[MWPhoto alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:format,string,pageIndex+i]]];
photo.caption = [NSString stringWithFormat:@"第%i页(共%i页)", i+1, pageTotal];
[photos addObject:photo];
}
[dataArray addObjectsFromArray:photos];
NSString * uid1=[NSString stringWithFormat:@"%@",[comicDetailDictionary objectForKey:@"id"]];
NSString * cid1=[NSString stringWithFormat:@"%@",[comicDetailDictionary objectForKey:@"lid"]];
BookDownInfo * book=[base LocalBookDownInfo:uid1 cid:cid1];
MWPhotoBrowser *photoBrowser = [[MWPhotoBrowser alloc] initWithDelegate:self];
[photoBrowser setCurrentPhotoIndex:book.readpage];
photoBrowser.title = [comicDetailDictionary objectForKey:@"bookname"];
[photoBrowser setDisplayActionButton:NO];
[photoBrowser setDisplayNavArrows:YES];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:photoBrowser];
[self presentModalViewController:nc animated:YES];
}
#pragma mark - MWPhotoBrowserDelegate
- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser
{
return dataArray.count;
}
- (id<MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index
{
return (MWPhoto *)dataArray[index];
}
- (void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index
{
NSString * uid=[NSString stringWithFormat:@"%@",[comicDetailDictionary objectForKey:@"id"]];
NSString * cid=[NSString stringWithFormat:@"%@",[comicDetailDictionary objectForKey:@"lid"]];
[base updatelist:uid cid:cid subStatus:index];
}