Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

个人页面里面的问题 #3

Open
ab65902265 opened this issue Jan 27, 2016 · 10 comments
Open

个人页面里面的问题 #3

ab65902265 opened this issue Jan 27, 2016 · 10 comments

Comments

@ab65902265
Copy link

就是个人页面里面已经有了点击每个动态的方法,图片是不能放大的。有没有接口方法可以让个人页面里面的图片可以放大,纯文字就显示一个新的页面看到评论。像微信那样,如果没有,您有什么介意我解决这个问题呢。初学不久,很喜欢这个库,望回复。多谢大神

@anyunzhong
Copy link
Owner

图片放大是用了一个叫 photobrowser的库 在时间轴那个页面 图文混排那个cell有 加上就行了

@ab65902265
Copy link
Author

-(void)updateWithImages:(NSMutableArray *)images srcImages:(NSMutableArray *)srcImages oneImageWidth:(CGFloat)oneImageWidth oneImageHeight:(CGFloat)oneImageHeight
{
self.images = images;
self.srcImages = srcImages;

if (images.count == 1) {
    _oneImageView.hidden = NO;
    _oneImageButton.hidden = NO;
    if (oneImageWidth > OneImageMaxWidth) {
        _oneImageView.frame = CGRectMake(0, 0, OneImageMaxWidth, oneImageHeight*(OneImageMaxWidth/oneImageWidth));
        _oneImageButton.frame = CGRectMake(0, 0, OneImageMaxWidth, oneImageHeight*(OneImageMaxWidth/oneImageWidth));;
    }else{
        _oneImageView.frame = CGRectMake(0, 0, oneImageWidth, oneImageHeight);
        _oneImageButton.frame = CGRectMake(0, 0, oneImageWidth, oneImageHeight);
    }
    [_oneImageView sd_setImageWithURL:[NSURL URLWithString:[images objectAtIndex:0]]];
    _oneImageButton.tag = 0;

}else{
    _oneImageView.hidden = YES;
}

for (int i=0; i< _imageViews.count; i++) {
    DFImageUnitView *imageUnitView = [_imageViews objectAtIndex:i];

    if (images.count == 1) {
        imageUnitView.hidden = YES;
    }else{

        if (images.count == 4) {
            if (i == 0 || i == 1 ) {
                [imageUnitView.imageView sd_setImageWithURL:[NSURL URLWithString:[images objectAtIndex:i]]];
                imageUnitView.hidden = NO;
                imageUnitView.imageButton.tag = i;
            }else if (i == 3 || i == 4 ) {
                [imageUnitView.imageView sd_setImageWithURL:[NSURL URLWithString:[images objectAtIndex:i-1]]];
                imageUnitView.hidden = NO;
                imageUnitView.imageButton.tag = i-1;
            }else{
                imageUnitView.hidden = YES;
            }
        }else{
            if (i < images.count) {
                [imageUnitView.imageView sd_setImageWithURL:[NSURL URLWithString:[images objectAtIndex:i]]];
                imageUnitView.imageButton.tag = i;
                imageUnitView.hidden = NO;
            }else{
                imageUnitView.hidden = YES;
            }
        }
    }

}

}

-(void) onClickImage:(UIView *) sender
{

NSLog(@"tag: %ld", (long)sender.tag);
MJPhotoBrowser *browser = [[MJPhotoBrowser alloc] init];

NSMutableArray *photos = [NSMutableArray array];

if (self.srcImages.count > 1) {

    for (int i=0; i<self.images.count; i++) {
        MJPhoto *photo = [[MJPhoto alloc] init];
        photo.url = [NSURL URLWithString:[self.srcImages objectAtIndex:i]];
        photo.srcImageView = ((DFImageUnitView *)[_imageViews objectAtIndex:i]).imageView;
        [photos addObject:photo];
    }

}else{
    MJPhoto *photo = [[MJPhoto alloc] init];
    photo.url = [NSURL URLWithString:[self.srcImages objectAtIndex:0]];
    photo.srcImageView = _oneImageView;
    [photos addObject:photo];

}


browser.photos = photos;
browser.currentPhotoIndex = sender.tag;

[browser show];

}

是这两个方法吗,如果是,该怎么加呢

@anyunzhong
Copy link
Owner

就这个啊

for (int i=0; i<self.images.count; i++) {
MJPhoto *photo = [[MJPhoto alloc] init];
photo.url = [NSURL URLWithString:[self.srcImages objectAtIndex:i]];
photo.srcImageView = ((DFImageUnitView *)[_imageViews objectAtIndex:i]).imageView;
[photos addObject:photo];
}

browser.photos = photos;
browser.currentPhotoIndex = sender.tag;

[browser show];

有多少张照片就有多少个MJPhoto
browser.currentPhotoIndex = sender.tag; 这一行表示点的第一张 这样大图之后 就直接显示相应的图片

@ab65902265
Copy link
Author

但是在个人页面里面的图片 cover是一个字符串类型,我找不到他传值给谁 有是谁生成了个人页面里面的那个图像
求解呀

@ab65902265
Copy link
Author

方便的话加qq解决咯,多谢大神了。 q号:897759425

@ab65902265
Copy link
Author

摆脱大神帮我解决啊!方法封装的太深了 我逻辑理不过来了。好乱,求大神指导啊

@ab65902265
Copy link
Author

大哥 还在吗?看到麻烦回复一下,感激不尽!

@anyunzhong
Copy link
Owner

加我q 2642754767

@GaoYingQiu
Copy link

大神@anyunzhong

@GaoYingQiu
Copy link

@anyunzhong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants