新浪微博客户端(35)-使用NSMutableAttributedString实现多行文本的效果
DJComposeViewController.m
import "DJComposeViewController.h"
#import "DJAccountTool.h" @implementation DJComposeViewController - (void)viewDidLoad { [super viewDidLoad];
[self initNavigationView];
[self initInputView]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated];
self.navigationItem.rightBarButtonItem.enabled = NO; } /** 初始化NavigationView */
- (void)initNavigationView { self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStyleDone target:self action:@selector(finish)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"发送" style:UIBarButtonItemStylePlain target:self action:@selector(send)]; UILabel *titleView = [[UILabel alloc] init];
titleView.width = ;
titleView.height = ;
titleView.numberOfLines = ; // 设置titleView 为多行显示
titleView.textAlignment = NSTextAlignmentCenter; DJAccount *account = [DJAccountTool account];
NSString *nickName = account.screen_name;
NSString *prefix = @"发微博";
NSString *str = [NSString stringWithFormat:@"%@\n%@",prefix,nickName];
NSRange nick_name_range = [str rangeOfString:nickName];
NSRange prefix_range = [prefix rangeOfString:prefix]; NSMutableAttributedString *titleStr = [[NSMutableAttributedString alloc] initWithString:str];
[titleStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:] range:nick_name_range];
[titleStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:] range:prefix_range]; titleView.attributedText = titleStr;
self.navigationItem.titleView = titleView; } /** 初始化输入区域 */
- (void)initInputView { UITextView *inputView = [[UITextView alloc] init];
inputView.frame = self.view.bounds;
[self.view addSubview:inputView]; } - (void)finish { [self dismissViewControllerAnimated:YES completion:nil]; } /** 发微博 */
- (void)send { } @end
最终效果:

新浪微博客户端(35)-使用NSMutableAttributedString实现多行文本的效果的更多相关文章
- Aisen仿新浪微博客户端项目源码
新浪目前已经限制了第三方微博的很多API接口,加上平常时间不够,所以后续可能不会面向产品的去维护Aisen,不过也有了一些新的方向,例如引入最新Android-support-library,在一个完 ...
- Android应用--新浪微博客户端新特性滚动视图和启动界面实现
新浪微博客户端新特性滚动视图和启动界面实现 2013年8月20日新浪微博客户端开发之启动界面实现 前言: 使用过新浪微博客户端的童鞋都清楚,客户端每一次升级之后第一次启动界面就会有新特性的介绍,用户通 ...
- android 新浪微博客户端的表情功能的实现
这是一篇好文章,我转来收藏,技术的最高境界是分享. 最近在搞android 新浪微博客户端,有一些心得分享弄android客户端表情功能可以用以下思路1.首页把新浪的表情下载到本地一文件夹种,表情图片 ...
- 新浪微博客户端开发之OAuth认证篇
新浪微博客户端开发之OAuth认证篇 2013年7月29日新浪微博客户端开发 OAuth2.0授权机制我在这里就不浪费口舌了,有很多大牛都发表过相关的文章解释OAuth2.0认证的流程,我就随便找了一 ...
- android开发新浪微博客户端 完整攻略 [新手必读]
开始接触学习android已经有3个礼拜了,一直都是对着android的sdk文档写Tutorials从Hello World到Notepad Tutorial算是初步入门了吧,刚好最近对微博感兴趣就 ...
- 四次元新浪微博客户端Android源码
四次元新浪微博客户端Android源码 源码下载:http://code.662p.com/list/11_1.html [/td][td] [/td][td] [/td][td] 详细说明:http ...
- 35个让人惊讶的CSS3动画效果
1. Pure CSS Coke Can 2. Colorful Clock 3. jQuery DJ Hero 4. Animated Pricing Column 5. Slick jQuery ...
- Android新浪微博客户端(七)——ListView中的图片异步加载、缓存
原文出自:方杰|http://fangjie.info/?p=193转载请注明出处 最终效果演示:http://fangjie.sinaapp.com/?page_id=54 该项目代码已经放到git ...
- [Python爬虫] Selenium爬取新浪微博客户端用户信息、热点话题及评论 (上)
转载自:http://blog.csdn.net/eastmount/article/details/51231852 一. 文章介绍 源码下载地址:http://download.csdn.net/ ...
随机推荐
- c# 读取嵌入式文件
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Reflect ...
- C++强制类型转换操作符 dynamic_cast
dynamic_cast是四个强制类型转换操作符中最特殊的一个,它支持运行时识别指针或引用. >>>>>>>>>>>编译器的RTTI设 ...
- 转发;Dota英文名
http://esports.17173.com/content/2011-02-17/20110217163225753.shtml 有的英雄的名字真的很漂亮,也给那些学校里英文各种悲剧的同鞋增加点 ...
- 操作系统中的IPC机制
按发送路径来看,可分为直接通信和间接通信. 1. 直接通信 (1)进程必须正确的命名对方 send (P, message) – 发送信息到进程P receive(Q, message) – 从进程 ...
- javascript要不要用来处理业务逻辑
这个问题,我现在才明白该怎样描述这个已经困惑了我很久的问题,在公司做的项目中,js对于数据验证起到了很大的作用,但是这使得整个项目的业务逻辑变得零散,甚至混乱 现在公司里的项目就是这样的.现在再想想, ...
- 【codevs1043】 方格取数
http://codevs.cn/problem/1043/ (题目链接) 题意 N*N的方格,每个格子中有一个数,寻找从(1,1)走到(N,N)的两条路径,使得取到的数的和最大. Solution ...
- 自动存储管理 ASM (转)
文章转自:http://www.itpub.net/thread-1342473-1-1.html 自动存储管理 (ASM) ASM 是 Oracle 数据库 10g 中一个非常出色的新特性,它以平台 ...
- duxcms SQL Injection In /admin/module/loginMod.class.php
目录 . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 duxcms是一款采用PHP开发,基于HMVC规则开发适合中小企业.公司.新闻.个 ...
- Linux inode && Fast Directory Travel Method(undone)
目录 . Linux inode简介 . Fast Directory Travel Method 1. Linux inode简介 0x1: 磁盘分割原理 字节 -> 扇区(sector)(每 ...
- Arrya数组添加过滤条件
var arr = new Array(); arr.push(); arr.push(); arr.push(); var rs = arr.filter(function (value,index ...