实现每个点赞用户点击的带属性的字符串

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

#pragma mark - 点击各个点赞用户-(void)setClicked:(TweetCell *)cell andOSCTweet:(OSCTweet *)tweet
{NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:tweet.likeListString];//遍历每个点赞用户的名称for (int i = 0; i < 3 && i < tweet.likeCount; i++){OSCUser *user = tweet.likeList[i];NSRange nameRange = [tweet.likeListString rangeOfString:user.name];[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor nameColor] range:nameRange];[cell.likeListLabel addLinkToURL:[NSURL URLWithString:[NSString stringWithFormat:@"userid:%lld", user.userID]] withRange:nameRange];}NSRange numRange = [tweet.likeListString rangeOfString:[NSString stringWithFormat:@"%d人", tweet.likeCount]];[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor nameColor] range:numRange];[cell.likeListLabel addLinkToURL:[NSURL URLWithString:[NSString stringWithFormat:@"tweetid:%lld", tweet.tweetID]] withRange:numRange];cell.likeListLabel.attributedText = attributedString;cell.likeListLabel.delegate = self;}
#pragma mark - TTTAttributedLabelDelegate
- (void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url
{NSArray *arrayStr = [url.absoluteString componentsSeparatedByString:@":"];if ([arrayStr[0] isEqualToString:@"userid"]) {UserDetailsViewController *userDetailsVC = [[UserDetailsViewController alloc] initWithUserID:((NSNumber *)arrayStr[1]).longLongValue];[self.navigationController pushViewController:userDetailsVC animated:YES];} else {TweetsLikeListViewController *likeListCtl = [[TweetsLikeListViewController alloc] initWithtweetID:((NSNumber *)arrayStr[1]).longLongValue];[self.navigationController pushViewController:likeListCtl animated:YES];}}

181811_ZP5W_2312463.png

转载于:https://my.oschina.net/pingAds/blog/416401

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/460185.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

xampp php5.6 7.1共存,New XAMPP with PHP 7.2.8, 7.1.20, 7.0.31 5.6.37

嗨&#xff0c;阿帕奇的朋友们&#xff01;We just released new versions of XAMPP for all platforms with the latest PHP versions: 7.2.8, 7.1.20, 7.0.31 & 5.6.37.您可以下载这些新版本http://www.apachefriends.org/download.html.7.2.8 / 7.1.20 / 7.0.31 / 5.6.3…

基于.net开发chrome核心浏览器【四】

原文:基于.net开发chrome核心浏览器【四】一&#xff1a; 上周去北京出差&#xff0c;给国家电网的项目做架构方案&#xff0c;每天都很晚睡&#xff0c;客户那边的副总也这样拼命工作。 累的不行了&#xff0c;直接导致第四篇文章没有按时发出来。 希望虚心学习1&#xff0c;小…

php5.6 pdo.dll 没有,php5.6没有pdo怎么办

php5.6没有pdo是因为在php5.6中php已经内置了pdo功能&#xff0c;只需要在php.ini文件中将“extensionphp_pdo_firebird.dll”等配置项打开即可。推荐&#xff1a;《PHP视频教程》php5.6中没有php.pdo.dll文件我下载的php 5.6要使用pdo模块&#xff0c;但是通过百度发现发现没有…

网页的背景图片代码

网页背景图片代码1.(最普遍类) <style>body{background-image:url(logo.gif);background-repeat:no-repeat;background-position:center}</style> 说明:以上代码为网页背景图片固定代码&#xff01;网页背景图片固定代码&#xff0c;这样&#xff0c;当向下拉网页时…

andriod 新建 Activity_ Form (详细设置)

参考&#xff1a; Starting Another Activity 去创建Activity New->Other->Android->Android Activity->BlankActivity&#xff1a; 输入对应的信息&#xff1a; 创建完毕后&#xff0c;可以看到新建了对应的 src下面的java文件 layout下面的xml 等等&#xff1a; …

php laypage,layui laypage组件常见用法总结

laypage 的使用非常简单&#xff0c;指向一个用于存放分页的容器&#xff0c;通过服务端得到一些初始值&#xff0c;即可完成分页渲染。核心方法&#xff1a; laypage.render(options) 来设置基础参数。一、laypage的常用基础参数layui.use([laypage], function () {laypage l…

Swift标识符和关键字

任何一种计算机语言都离不开标识符和关键字&#xff0c;下面我们将详细介绍Swift标识符和关键字。 标示符 标识符就是给变量、常量、方法、函数、枚举、结构体、类、协议等指定的名字。构成标识符的字母均有一定的规范&#xff0c;Swift语言中标识符的命名规则如下&#xff1a;…

nyist 17 -----记忆式搜索------Accept

//记忆式搜索 #include <iostream>#include<stdio.h>#include<string.h>using namespace std;char a[10002];int b[10002];int n,ans;int f(int x){ int i,t; if(b[x]>0) return b[x]; b[x]1; for(i0;i<x-1;i) { tf(i); if(a[i]<a[x] && b[…

asp.net matlab,ASP.NET与MATLAB混合编译以及数据传递【更新中】

本帖最后由 yinbo20081314 于 2015-5-20 00:35 编辑在VS环境的项目中&#xff0c;首先需要引用以下dll才能开启MATLAB混编。【引用1】MatlabApplication(Version 8.1) Type Library 1.0a1.jpg (42.85 KB, 下载次数: 9)2015-5-20 00:16 上传【引用2】在MATLAB安装地址下可以找到…

01背包 模板1 2 总结

物品质量 w[0] w[1] w[2] ....... w[n] 背包容量c T 物品价值 v[0] v[1] v[2] ....... v[n] 物品种类 n N &#xff08;一&#xff09;设DP(x,y) 表示 从前x项物品中 取出装入 体积为y的背包 的 物品的最…

matlab暂停音频,matlab 中的实时音频

matlab 中的实时音频音频系统工具箱™针对实时音频处理进行了优化. audioDeviceReader, audioDeviceWriter, audioPlayerRecorder,dsp.AudioFileReader 和 dsp.AudioFileWriter 器是为流式传输多通道音频而设计的, 它们提供了必要的参数, 以便您可以在吞吐量和延迟之间进行权衡…

js数组操作

2019独角兽企业重金招聘Python工程师标准>>> 1、数组的创建 var arrayObj new Array(); //创建一个数组 var arrayObj new Array([size]); //创建一个数组并指定长度&#xff0c;注意不是上限&#xff0c;是长度 var arrayObj new Array([element0[, element1[…

用webstorm自动编译less产出css和sourcemap

css产出sourcemap有什么用呢&#xff0c;可能大家要问这个问题了。 请移步这里 https://developers.google.com/chrome-developer-tools/docs/css-preprocessors?hlzh-CN 在chrome中我们通过sourcemap可以直接调试less源文件文件&#xff0c;这是一个非常强大的功能。 下面由我…

远近旋转球体

2019独角兽企业重金招聘Python工程师标准>>> static int day 20; void mydisplay(void) {int a clock();glEnable(GL_DEPTH_TEST);glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);//清空颜色缓存与深度缓存glMatrixMode(GL_PROJECTION);//接下来要进行的操作…

iOS开发UI篇—CALayer简介

一、简单介绍在iOS中&#xff0c;你能看得见摸得着的东西基本上都是UIView&#xff0c;比如一个按钮、一个文本标签、一个文本输入框、一个图标等等&#xff0c;这些都是UIView。 其实UIView之所以能显示在屏幕上&#xff0c;完全是因为它内部的一个图层&#xff0c;在创建UIVi…

php 多进程 常驻内存,PHP 多进程与信号中断实现多任务常驻内存管理 [Master/Worker 模型]...

本文章基于pcntl扩展做的多进程测试。进程调度策略父子进程的调度由操作系统来负责&#xff0c;具体先调度子进程还是父进程由系统的调度算法决定&#xff0c;当然可以在父进程加上延时或是调用进程回收函数pcntl_wait可以先让子进程先运行&#xff0c;进程回收的目的是释放进程…

RPG的错排

RPG的错排 Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 25 Accepted Submission(s) : 14 Problem Description今年暑假杭电ACM集训队第一次组成女生队,其中有一队叫RPG,但做为集训队成员之一的野骆驼竟然不知道…

读取properties

为什么80%的码农都做不了架构师&#xff1f;>>> //db 是文件名为db.properties private static final ResourceBundle bundle ResourceBundle.getBundle("db");public static String getProperties(String key){return bundle.getString(key);} 转载于:…

Java 8新特性(二)

2019独角兽企业重金招聘Python工程师标准>>> 集合类的批处理&#xff1a; Java8除了Lambda表达式外还提供了另一个重要的特性&#xff0c;即集合的批处理操作&#xff0c;集合类的批处理操作API的目的是实现集合类的“内部迭代”&#xff0c;并期望充分利用现代多核…

Python 支付宝支付代码

2019独角兽企业重金招聘Python工程师标准>>> #!/usr/bin/env python # encoding: utf-8Created on 2011-1-5 author: codebackgmail.comimport hashlib import urllib2verfyURL{"https":"https://www.alipay.com/cooperate/gateway.do?servicenotif…