ios 微信朋友圈 开发技术分析
发布日期:2021-09-01 17:00:07 浏览次数:1 分类:技术文章

本文共 2061 字,大约阅读时间需要 6 分钟。

hot3.png

由于工作需求,需要开发一个类似的朋友圈功能,用于工作汇报。

1、地理信息获取,我采用了高德api   文档如下  (这个还是简单的,定位方便)

#import 
- (void)dingwei {        [_textView resignFirstResponder];        [AMapLocationServices sharedServices].apiKey =@"这里是你申请的token";    locationManager = [[AMapLocationManager alloc] init];    locationManager.delegate = self;        [locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];            // 带逆地理(返回坐标和地址信息)    [locationManager requestLocationWithReGeocode:YES completionBlock:^(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error) {                if (error)        {            NSLog(@"locError:{%ld - %@};", (long)error.code, error.localizedDescription);            self.addressLabel.text=error.localizedDescription;        }                if (regeocode)        {            //regcode包含了地址信息 打印下就可以获取        }                    }];    }

2、选择相机及相册 (具体代码可以看我之前的文章)

3、图片上传 (这快我搞了很久,一直都不明白,采用二进制的方式,这里也参考我之前的单独文章)

4、点击图片放大(这个也搞了很久,==!)

//思路//1、先获取原图的位置。//2、点击图片后,图片居中  这里加载2层,一层背景 一层图片。我用了AFNetworking 2.6版本的//3、异步加载图片,我这里用了SDWebImage 就简单了//4、进度条要的吧,一开始用了webview 效果很烂(放弃了) 后来用SDProgressView//5、点击放大 然后缩回去,记住用图片和背景都添加在window上 是并列关系。不然缩放的时候问题大大的。

5、文本高度问题。

  //工作日志   UITextView * blogView=[cell viewWithTag:4];    blogView.text=[dic objectForKey:@"content"];        CGSize  size = [blogView.text sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(240, 2000)                                 lineBreakMode: UILineBreakModeWordWrap];    //不允许滚动    blogView.scrollEnabled=NO;        CGRect  blogFrame=blogView.frame;    blogFrame.size.height=size.height+10;//获取自适应文本内容高度    blogView.frame=blogFrame;    [blogView endEditing:NO];

6、图片高度问题  这里要说明白的是,上传图片到后台,要存储缩略图的宽和高。然后获取图片的时候,先把图片大小设置好。

#pragma mark 自适应高度-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{    UITableViewCell *cell = [self tableView:_tableView cellForRowAtIndexPath:indexPath];        return cell.frame.size.height;}

参考资料:

https://github.com/rs/SDWebImage

转载于:https://my.oschina.net/u/554046/blog/631354

转载地址:https://blog.csdn.net/weixin_34122810/article/details/92002229 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:王车易位
下一篇:安卓与netty的整合开发资料准备

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2024年04月08日 06时18分45秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章